From = $email; $mail->FromName = $email; $mail->Host = $MailServer; $mail->Mailer = "smtp"; $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = $MailUsername; // SMTP username $mail->Password = $MailPassword; // SMTP password $mail->AddAddress($YourEmailAddress, $Yourname); $mail->AddReplyTo($ReplyToEmailAddress, $ReplyToEmailname); $mail->WordWrap = 50; // set word wrap to 50 characters $mail->IsHTML($mailtypetosend); // True for HTML, FALSE for plain text $mail->SetLanguage("en", "language/"); //Start the page action upon submittal if ($action == "contact" ) { if (empty($_POST['name'])) { $name = FALSE; $message .= '
Please enter your name
'; } else { $name = $_POST['name']; } if (empty($_POST['phone'])) { $phone = FALSE; $message .= '
Please enter a phone number to reach you at
'; } else { $phone = $_POST['phone']; } if (empty($_POST['email'])) { $email = FALSE; $message .= '
Please enter your email address
'; } else { $email = $_POST['email']; } if (empty($_POST['comments'])) { $comments = FALSE; $message .= '
You did not enter in a message
'; } else { $comments = $_POST['comments']; } if($comments && $email && $phone && $name){ $mail->Subject = "Contact form submitted"; $mail->Body = "A contact form has been submitted from the website\nHere are the details:\n\n\n"; $mail->Body .= "Name: $name \n"; $mail->Body .= "Phone number: $phone\n"; $mail->Body .= "Email Address: $email\n"; $mail->Body .= "Message: $comments\n\n\n"; if(!$mail->Send()) { echo "Message could not be sent.

"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } else { $sent = 1; } echo "
Thank you for the message. You will receive a reply as soon as possible.
Email Address: $email
Message: $comments
"; } } if(isset($message)) {echo "$message
";} if($sent != 1){ echo "
Email
Message

 

 

"; } ?>