SMTPDebug = SMTP::DEBUG_SERVER; //Enable verbose debug output $mail->isSMTP(); //Send using SMTP $mail->Host = 'ssl://smtp.gmail.com'; //Set the SMTP server to send through $mail->SMTPAuth = true; //Enable SMTP authentication $mail->Username = 'sales@anwisystems.com'; //SMTP username $mail->Password = 'Anwisales'; //SMTP password $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption // $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail $mail->Port = 587; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS` //Recipients $mail->setFrom('sales@anwisystems.com', 'Anwi Sales'); $mail->addAddress('sales@anwisystems.com', 'Anwi'); //Add a recipient //$mail->addAddress('ellen@example.com'); //Name is optional $mail->addReplyTo('sales@anwisystems.com', 'reply-to-Anwi'); //$mail->addCC('cc@example.com'); //$mail->addBCC('bcc@example.com'); //Attachments // $mail->addAttachment('/var/tmp/file.tar.gz'); //Add attachments // $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); //Optional name //Send HTML or Plain Text email $mail->isHTML(true); if(!empty($_POST['contactemail'])){ $contactName=$_POST['contactname']; $email=$_POST['contactemail']; $phone=$_POST['contactnumber']; $message=$_POST['contactmessage']; } $body = ""; $body .= ""; $body .= ""; $body .= ""; $body .= ""; $body .= "
Contact Person$contactName
Email$email
Phone$phone
Message$message
"; $mail->Subject = "Contact From $contactName"; $mail->Body = $body; // $mail->AltBody = "This is the plain text version of the email content"; try { $mail->send(); echo 1; } catch (Exception $e) { echo "Mailer Error: " . $mail->ErrorInfo; } ?>