I hope this is ok to ask for help here.
I have a script for Mail that is part of a landing page, I cannot get the mail to work.
Is it possible to see from the script what I am doing wrong?
Let's Talk About Your Home
Connect with BrentMore Roofing here about your roofing needs.
Name
Email
Phone
Mail.php
<?php define('admin_email','[email protected]'); // Change admin email here for example [email protected] define('website_name','Brentmoreroofing.com'); // Change website name here for example yoursite.com define('website_url', 'http://www.brentmoreroofing.com'.$_SERVER['HTTP_HOST']); define('EMAIL_FROM', '[email protected]'.$_SERVER['HTTP_HOST']); function strict_secure($str){ $str = strip_tags(trim($str)); return $str; } function sendEmail($to,$from,$subject,$message,$headname){ $headers="MIME-Version: 1.0" . "\r\n"; $headers.="Content-type: text/html; charset=utf-8" . "\r\n"; $headers.="From: ".$headname.'<'.$from.'>'; return mail ($to,$subject,$message,$headers); } if(isset($_POST['action']) && $_POST['action']=='submitform') { $N = array(); $N = $_POST['formInput']; $path = $_SERVER['HTTP_REFERER']; $admin_message = 'Dear Admin, Form submitted on '.website_url.'
Detail is as following.
'.ucwords($label).' : '.$value.'
'; } $admin_message .= 'Form submitted on URL:'.$path.'
'; $admin_message .= ''; $admin_message .= 'Regards,
'.website_name.'
'.website_url.' '; $user_message = 'Dear '.strict_secure($N['name']).',
'; $user_message .= 'Thank you very much for submitting information. We will contact you shortly.'; $user_message .= 'Regards,
'.website_name.'
'.website_url.' '; $admin_subject = 'Form Received From '.website_name; $user_subject = 'Thank you - '.website_name; $sendToAdmin = $sendToUsers = ''; $sendToAdmin = sendEmail(admin_email,EMAIL_FROM,$admin_subject,$admin_message,website_name); if( isset( $N['email'] ) && ! empty( $N['email'] ) ){ $sendToUsers = sendEmail(strict_secure($N['email']),EMAIL_FROM,$user_subject,$user_message,website_name); } if($sendToAdmin || $sendToUsers) { $message ='Success::
Message Sent Successfully.
';
}else{
$message ='Error::Something Went Wrong While Sending Message.
';
}
echo $message;
}
exit();
?>
Thank you if you can help and please forgive me if this is not the place for this.
Thank you