0)) {
$name = stripslashes(strip_tags($_POST['name']));
} else {$name = 'No name entered';}
if ((isset($_POST['phone'])) && (strlen(trim($_POST['phone'])) > 0)) {
$phone = stripslashes(strip_tags($_POST['phone']));
} else {$phone = 'No phone entered';}
if ((isset($_POST['email'])) && (strlen(trim($_POST['email'])) > 0)) {
$email = stripslashes(strip_tags($_POST['email']));
} else {$email = 'No email entered';}
if ((isset($_POST['datetimepicker'])) && (strlen(trim($_POST['datetimepicker'])) > 0)) {
$datetimepicker = stripslashes(strip_tags($_POST['datetimepicker']));
} else {$datetimepicker = 'No email entered';}
if ((isset($_POST['comment'])) && (strlen(trim($_POST['comment'])) > 0)) {
$comment = stripslashes(strip_tags($_POST['comment']));
} else {$phone = 'No comment entered';}
ob_start();
// Email Building
$to = $receiving_email_address;
$email = $_POST['email'];
$fromaddress = $_POST['email'];
$fromname = $_POST['name'];
$body = "Below are the details submitted by the user on your website.
Name:
".$_POST['name']."
Email: ".$_POST['email']."
Phone: ".$_POST['phone']."
Date & Time: ".$_POST['datetimepicker']."
Comment: ".$_POST['comment']."";
// Check if the security is filled
if ( $_POST['security'] == '' ) {
require("phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->CharSet = 'UTF-8';
// START SMTP HERE - CHANGE YOUR PARAMETERS HERE
$mail->Host = "smtp.gmail.com"; // SMTP server example
$mail->SMTPDebug = 1; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 465; // set the SMTP port for the GMAIL server
$mail->Username = "phpmailer7nstar@gmail.com"; // SMTP account username example
$mail->Password = "lnkfd9j3lknh03jd"; // SMTP account password example
// STOP SMTP HERE
$mail->From = $mail->Username;
$mail->AddAddress("$receiving_email_address");
$mail->IsHTML(true);
$mail->Subject = "$custom_subject";
$mail->Body = $body;
$mail->AltBody = "This is the text-only body";
if(!$mail->Send()) {
die($mail->ErrorInfo);
$recipient = $receiving_email_address;
$subject = 'Contact form failed';
$content = $body;
// Send Mail
mail($recipient, $subject, $content, "From: $receiving_email_address\r\nReply-To: $email\r\nX-Mailer: DT_formmail");
exit;
}
}
?>