We run a classified ad website.
The contact form (php) sends the message directly to the author of the ad by email. We were thinking to follow this Best practice for web-generated emailers.
To: recipient@domain1.com
From: writer-of-the-message@domain2.com
Sender: noreply@classified-website.com
Reply-To: writer-of-the-message@domain2.com
Deliverability is not perfect (Some, like yahoo, are very aggressive with their DMARC policy). Exemple if message author (FROM:
) is @yahoo and recipient (TO:
) is @gmail:
<xxxxxx@gmail.com>: host gmail-smtp-in.l.google.com[xx.xxx.xxx.xx] said:
550-5.7.1 Unauthenticated email from yahoo.com is not accepted due to domain's
550-5.7.1 DMARC policy. Please contact administrator of yahoo.com domain if
550-5.7.1 this was a legitimate mail. Please visit
550-5.7.1 https://support.google.com/mail/answer/2451690 to learn about DMARC
550-5.7.1 initiative. jq5si20832837wjc.74 - gsmtp (in reply to end of DATA command)
Exemple if message author (FROM:
) is @yahoo and recipient (TO:
) is @hotmail:
Diagnostic-Code: smtp; 550 5.7.0 (COL004-MC4F54) Unfortunately, messages
from (xx.xx.xx.xx) on behalf of (yahoo.com) could not be delivered due to
domain owner policy restrictions.
What is the solution?
Requirement: in their email client, the recipient should be able to flag writer-of-the-message@domain2.com
as spam if needed and not noreply@classified-website.com
.
We have seen some websites using this debatable solution:
To: recipient@domain1.com
From: "writer-of-the-message@domain2.com" <noreply@classified-website.com>
Reply-To: writer-of-the-message@domain2.com
Update: simplified php code as requested:
mail(
$to,
'Email title',
'Email body',
"From: \"" . $from . "\" <" . $from . ">\n" .
"Sender: noreply@classified-website.com\n" .
"Reply-To: \"" . $from . "\" <" . $from . ">\n" .
"Return-Path: " . $from,
'-f noreply@classified-website.com'
);