ajax = true;
$contact->to = $receiving_email_address;
$contact->from_name = $_POST['name'];
$contact->from_email = $_POST['email'];
$contact->subject = $_POST['subject'];
// Uncomment below code if you want to use SMTP to send emails. You need to enter your correct SMTP credentials
/*
$contact->smtp = array(
'host' => 'example.com',
'username' => 'example',
'password' => 'pass',
'port' => '587'
);
*/
/*$contact->add_message( $_POST['name'], 'From');
$contact->add_message( $_POST['email'], 'Email');
$contact->add_message( $_POST['message'], 'Message', 10);
echo $contact->send();*/
require_once "../../mailsmtp.php";
$receiving_email_address = 'sales@motioncontrol.co.ke';
$sending_email_address = 'system@motioncontrol.co.ke';
$email_to = $receiving_email_address. ", ";
$name_to = "MOTION CONTROL ENGINEERING SERVICES, ";
$header_to = 'MOTION CONTROL ENGINEERING SERVICES <' .$receiving_email_address. '>; ';
$header_sending = 'MOTION CONTROL ENGINEERING SERVICES <' .$sending_email_address. '>';
$from = $header_sending;
$MAIL_FROM_HEADER = $_POST['name'] .' <' .$_POST['email']. '>; ';
$MAIL_CC_HEADER = "";
$subject = $_POST['subject'];
$message = "
" .$_POST['message']. "
From ".$_POST['name']. ": " .$_POST['email']."
";
if (!empty($email_to)) {//send an email only if email address is available and batch notification is available
$to = $email_to;
// Always set content-type when sending HTML email
// $headers = "MIME-Version: 1.0" . "\r\n";
// $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// // More headers for php mail(function)
// $headers .= 'From: ' . $header_sending . "\r\n";
// $headers .= 'To: ' .$header_to . "\r\n";
// $headers .= 'Cc: ' . $MAIL_CC_HEADER . "\r\n";
// $headers .= 'Return-Path: ' . $MAIL_FROM_HEADER . "\r\n";
// $headers .= 'Reply-To: ' . $MAIL_FROM_HEADER . "\r\n";
//$headers .= 'BCc:' . "\r\n";
//For pearphp mail function
$headers = array ('From' => $header_sending,
'To' => $header_to,
'Cc' => $MAIL_CC_HEADER,
'Reply-To' => $MAIL_FROM_HEADER,
'Subject' => $subject,
"Content-Type" => "text/html");
if (sendmail($from, $to, $subject, $message, $headers)){
echo 'OK';
}
else{echo "Message could not be sent. Try again later.";}
}else{echo "Message could not be sent. Try again later.";}
?>
Your message has been sent. Thank you!