I'm running a new WordPress website on LEMP on Debian 7, sendmail installed.
I have a custom theme installed which has contact form.
Contact form says email sent but email actually not delivered. I have tried to remove $headers
from email, email delivered. Simple php mail function working properly. Same custom theme sending and delivering email through form at Shared host.
Here is part of custom form:
What is wrong with this? can anyone point me out what is wrong or how I can start sending emails?
if(!isset($hasError) && ($correct == true)) {
$admin = get_bloginfo('admin_email');
$portfolio = get_bloginfo('name');
$portfolio_url = home_url();
$emailTo = $admin;
$pro = get_the_title();
$subject = "You have an message for $pro";
$body = "Hello,
You've received an message from ".$name.", for ".$pro." fun name.
Here are message details:
--------------------------------
Buyer Name: ".$name."
Email: ".$email."
Message: ".$message." ".$CurrencyCode."
Message: ".$message."
---------
".$portfolio."
".$portfolio_url;
$headers = "From: ".$portfolio." <".$emailTo.">" . "
" . "Reply-To: " . $email;
wp_mail($emailTo, $subject, $body, $headers);
$emailSent = true;
}
Thank you!