I experienced a very strange issue with php mail() function on one of my servers yesterday. The story goes like this:
PHP mail() uses /usr/sbin/sendmail to send emails by default. I had a ded server with Plesk panel. I had configured the postfix mail server there to have valid DomainKey / DKIM / SPF authentications. DomainKey/DKIM signatures would work fine when clients sent emails using Outlook or Thunderbird, but DomainKey signatures got broken when emails were sent through PHP mail() function.
The reason was the wrong d=$DOMAIN variable used in DomainKey signature when emails were sent through php mail() function. Strangely enough, I found that it only happens when "FROM" header is set in $additional_headers of php mail() function. Therefore:
mail($dest_email, $subject, $message, "FROM: Mos GH mos@holding.com");
breaks DomainKey signatures. The workaround is to remove FROM header and put the sender in $additional_parameters variable:
mail($dest_email, $subject, $message, "", "-f mos@holding.com");
However you can't give your full name like this.
Alternatively one can use PHPMailer to send emails directly through SMTP instead of sendmail to avoid the issue.
p.s. You can send a test email message to check-auth@verifier.port25.com to see how well your emails are authenticated. It's a robot and usually replies back to you with your authentication results in seconds.
Subscribe to:
Post Comments (Atom)
How to export Apple Health / Google Fit training activity to TCX format
I own a Xiaomi Smart Band 7, and recently, my Mi Fitness app stopped syncing running activities to Strava. Mi Fitness supports syncing dat...
-
This post shows how to configure a mail proxy server to connect clients in an intranet to an external mail server. I will use SSL offloading...
-
I use this tutorial to setup RemoSIM.com product for customers. To do: - Add instructions for enabling fail2ban for asterisk - Fix the fre...
-
An updated version of this post is available here . I use this tutorial to setup RemoSIM.com product for customers. RasPBX – Asterisk for ...
No comments:
Post a Comment