开发者

Client not receiving emailed form contents

开发者 https://www.devze.com 2023-03-23 06:17 出处:网络
I\'ve got a simple form post that\'s being emailed to a client on submit. They are not receiving the form in their email. Doesn\'t seem to be a spam issue, as anyone on their domain won\'t receive th

I've got a simple form post that's being emailed to a client on submit.

They are not receiving the form in their email. Doesn't seem to be a spam issue, as anyone on their domain won't receive the contents, and they've checked开发者_如何学Python their spam filters.

If I send the contents to my email addresses on various mail servers and domains, I always receive them.

I call the host's support (mediaTemple) and they thought immediately what the problem--that the mail services were turned on for the web site, but mail was being handled by another machine (Google). Turned of mail services in the mediaTemple Plesk control panel. Client still isn't receiving emails. Any suggestions?

I've ommitted a bunch of the fields, but just so you all can get an idea of the PHP:

$to = "me@null.net, client@theirwebsite.com";
$subject = "Web Site Feedback";

$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$date_of_visit = $_POST['date_of_visit'];
$first_visit = $_POST['first_visit'];

$body = "From: $first_name $last_name\n Date of Visit: $date_of_visit\n First Visit: $first_visit\n";

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/plain; charset=UTF-8' . "\r\n";
$headers .= 'From: Client Name <client@theirwebsite.com>'. "\r\n";
$headers .= "Reply-To: " . "<client@theirwebsite.com>\r\n";
$headers .= "Return-path: client@theirwebsite.com";

mail($to, $subject, $body, $headers)


Check if the mail function fails...

if (!mail($to, $subject, $body, $headers)) {
   echo "Failed to send email...";
}

If it works sending to a different email address that's not theirs, then it's definetly a spam issue.

You can try setting up an SPF record on the mail server to verify it's not spam and also consider using DKIM (PHPMailer have good DKIM support).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号