IsSMTP(); // set mailer to use SMTP
$mail->Host = "mail.domain.com"; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "outbound@domain.com"; // SMTP username
$mail->Password = "password"; // SMTP password
// Set Sender/Recipient
$mail->From = "contactform@domain.com";
$mail->FromName = "From Name";
$mail->AddAddress("info@domain.com", "Domain name"); //Address of recipient
// Build Message Body
$msg = "
Name: $name
Email: $email
Telephone: $telephone
Message: $message
";
// Set Subject + Body + Settings
$mail->Subject = "Subject Title";
$mail->Body = $msg;
$mail->WordWrap = 50; // set word wrap to 50 characters
// Send Message and Report
if(!$mail->Send())
{
echo "Message could not be sent. ";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
echo "Mail was sent thank you!";
echo sprintf("
Go Back ",$_SERVER['HTTP_REFERER']);
?>