| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?php
- date_default_timezone_set("Australia/Hobart");
- $datetime = date("D dS M y @ h:i a");
- //error_reporting(E_ALL);
- //ini_set('display_errors', 1);
- error_reporting(E_ERROR | E_PARSE);
- /*
- * PHPMailer simple contact form example.
- * If you want to accept and send uploads in your form, look at the send_file_upload example.
- */
- //Import the PHPMailer class into the global namespace
- use PHPMailer\PHPMailer\PHPMailer;
- use PHPMailer\PHPMailer\SMTP;
- use PHPMailer\PHPMailer\Exception;
- require 'phpmailer/src/Exception.php';
- require 'phpmailer/src/PHPMailer.php';
- require 'phpmailer/src/SMTP.php';
- if (array_key_exists('email', $_POST)) {
- $err = false;
- $msg = '';
- $email = '';
- //Apply some basic validation and filtering to the subject
- if (array_key_exists('subject', $_POST)) {
- $subject = substr(strip_tags($_POST['subject']), 0, 255);
- } else {
- $subject = 'No subject given';
- }
- //Apply some basic validation and filtering to the query
- if (array_key_exists('query', $_POST)) {
- //Limit length and strip HTML tags
- $query = substr(strip_tags($_POST['query']), 0, 16384);
- } else {
- $query = '';
- $msg = 'No query provided!';
- $err = true;
- }
- //Apply some basic validation and filtering to the name
- if (array_key_exists('name', $_POST)) {
- //Limit length and strip HTML tags
- $name = substr(strip_tags($_POST['name']), 0, 255);
- } else {
- $name = '';
- }
- //Apply some basic validation and filtering to the name
- if (array_key_exists('mobile', $_POST)) {
- //Limit length and strip HTML tags
- $mobile = substr(strip_tags($_POST['mobile']), 0, 255);
- } else {
- $mobile = '';
- }
- //Apply some basic validation and filtering to the name
- if (array_key_exists('property_address', $_POST)) {
- //Limit length and strip HTML tags
- $property_address = substr(strip_tags($_POST['property_address']), 0, 255);
- } else {
- $property_address = '';
- }
- //Make sure the address they provided is valid before trying to use it
- if (array_key_exists('email', $_POST) && PHPMailer::validateAddress($_POST['email'])) {
- $email = $_POST['email'];
- } else {
- $msg .= 'Error: invalid email address provided';
- $err = true;
- }
- if (!$err) {
- $mail = new PHPMailer();
- //$mail->SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output $mail->SMTPDebug = SMTP::DEBUG_SERVER;
- $mail->isSMTP();
- $mail->Host = 'mail.tazz.com.au';
- $mail->SMTPAuth = true;
- $mail->Username = 'itadmin@tazz.com.au';
- $mail->Password = 'e]GG%LI,6$cx';
- $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
- $mail->Port = 465;
- $mail->CharSet = PHPMailer::CHARSET_UTF8;
- //It's important not to use the submitter's address as the from address as it's forgery,
- //which will cause your messages to fail SPF checks.
- //Use an address in your own domain as the from address, put the submitter's address in a reply-to
- $mail->setFrom('ben@tazz.com.au', (empty($name) ? 'Contact form' : $name));
- $mail->addAddress('ben@tazz.com.au');
- $mail->addReplyTo($email, $name);
- //Attachments
- //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); //Optional name
- //Content
- $mail->isHTML(true); //Set email format to HTML
- $mail->Subject = 'Contact form: ' . $subject;
- $message = '<html><body>';
- $message .= '<h2><b>' . $subject . ' Contact Enquiry from</b></h2><br>';
- $message .= '<p>Name: <b>' . $name . '</b></p>';
- $message .= '<p>Email Address: <b>' . $email . '</b></p>';
- $message .= '<p>Mobile Number: <b>' . $mobile . '</b></p>';
- $message .= '<p>Property Address: <b>' . $property_address . '</b></p>';
- $message .= '<p>Enquiry:<br>' . $query . '</p><br><br>';
- $message .= $datetime . '<br><br>';
- $message .= '<span style="font-weight:bold; font-size: 12px color:#635A4A;">' . $name . '</span><br><span style="color:#D82508;font-size: 11px">Blueprint Sudio</span><br>';
- $message .= '<br><span style="font-family: arial; color: #635A4A; font-size: 12px">Blueprint Sudio | 34 Coplestone Street | Scottsdale | Tas | 7260</span><br>';
- $message .= '<span style="font-family: arial; color: #635A4A; font-size: 11px;"><b>M</b> 0402 984 082<b> | E</b> design@studioblueprint.com.au<b> | W</b> studioblueprint.com.au</span><br><br>';
- $message .= '<a href="https://studioblueprint.com.au"><img style="max-width: 250px; height: auto;" src="https://studioblueprint.com.au/internal/images/blueprint-full-logo-medium.png" alt="Blueprint Sudio" title="Blueprint Sudio"></a><br><br>';
- $message .= '<br><br><span style="font-family: arial; color: lightgrey; font-size: 9px;">Blueprint Sudio Legal Disclaimer: This email is confidential and may contain legally privileged information. If you are not the intended recipient , you must not disclose or use the information contained in it. If you have received this email in error, please notify us immediately by return email and delete the document.</span></p>';
- $message .= '</body></html>';
- $mail->Body = $message;
- if (!$mail->send()) {
- $msg .= 'Mailer Error: ' . $mail->ErrorInfo;
- } else {
- $msg .= 'Message sent!';
- }
- }
- } ?>
|