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->From = "$email";
$mail->FromName = "$fromname";
$mail->AddAddress("$receiving_email_address","$receiving_email_address_name");
$mail->IsHTML(true);
$mail->Subject = "$custom_subject";
$mail->Body = $body;
$mail->AltBody = "This is the text-only body";
if(!$mail->Send()) {
$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;
}
}
?>