My Exim configuration was working just fine until I recently reviewed it and noticed that there were a number of settings with the yellow warning icons by them indicating that they had not been previously set. I figured they were settings corresponding to a newer version of Exim and that setting them to the defaults and saving the configuration wouldn't do any harm. I know; I should have backed up my configuration before doing so, but I didn't.
After saving the configuration, I noticed that the PHP scripts I run via cron that used the PHP mail() function were no longer emailing me as they did before I updated the Exim configuration, but the scripts that used the mail() function in my public_html folder were working.
To see if I could determine what was wrong, I wrote a very simple PHP script whose sole function was to send me an email.
I ran it from a browser by browsing to the script, /test/test_PHP_mail.php, and received the email with the following output in /var/log/exim_mainlog:
Next, I opened a terminal and using SSH as the user for the domain, cd'd to the folder containing the test script, and ran the script using the following command:
That email failed to come through, and I got the following output in exim_mainlog:
I noticed that the sender verification failed because there is no user called "username" at host.hostingdomainname.com. And there aren't, because "host" is the subdomain of the main domain for my VPS where the service SSL certificate is installed, and there are no email accounts there.
Next, I tried altering the PHP script to use the "-f" parameter to set the sender to an actual email account on the domain "mydomain.com."
After altering the script, I ran it again via SSH using the same command as above, and the mail went through just fine, with the following output in exim_mainlog:
The only problem I see there is the "SSL verify error: certificate name mismatch," but the email did come through just fine.
I have a workaround, since adding the "-f" parameter to all my scripts got my emails going through once more, and I all the web software that can to use email via SMTP, which also works, but I'm still curious what I did that caused this.
So, I have two questions. First of all, what setting in my Exim configuration would account for the failure of mail to go through when a script is run via SSH or cron, but to succeed when it's run via a browser going to the same script? Second, why the "SSL verify error: certificate name mismatch," when my service SSL certificate appears to be working fine otherwise?
After saving the configuration, I noticed that the PHP scripts I run via cron that used the PHP mail() function were no longer emailing me as they did before I updated the Exim configuration, but the scripts that used the mail() function in my public_html folder were working.
To see if I could determine what was wrong, I wrote a very simple PHP script whose sole function was to send me an email.
I ran it from a browser by browsing to the script, /test/test_PHP_mail.php, and received the email with the following output in /var/log/exim_mainlog:
Code:
2016-01-08 13:05:57 cwd=/home/username/public_html/test 3 args: /usr/sbin/sendmail -t -i
2016-01-08 13:05:57 1aHcMH-0005UP-S5 <= [email protected] U=username P=local S=630 T="PHP Mail Test" for [email protected]
2016-01-08 13:05:57 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1aHcMH-0005UP-S5
2016-01-08 13:05:57 1aHcMH-0005UP-S5 => recipient <[email protected]> R=virtual_user T=virtual_userdelivery
2016-01-08 13:05:57 1aHcMH-0005UP-S5 Completed
Code:
/usr/local/bin/php test_PHP_mail.php
Code:
2016-01-08 13:07:31 cwd=/home/username/public_html/test 3 args: /usr/sbin/sendmail -t -i
2016-01-08 13:07:31 1aHcNn-00000g-Ve <= [email protected] U=username P=local S=559 T="PHP Mail Test" for [email protected]
2016-01-08 13:07:32 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1aHcNn-00000g-Ve
2016-01-08 13:07:32 SMTP connection from [127.0.0.1]:34669 (TCP/IP connection count = 3)
2016-01-08 13:07:32 1aHcNn-00000g-Ve [127.0.0.1] SSL verify error: certificate name mismatch: "/OU=Domain Control Validated/OU=EssentialSSL/CN=host.hostingdomainname.com"
2016-01-08 13:07:32 SMTP connection identification H=localhost A=127.0.0.1 P=34669 U=mailnull ID=47 S=mailnull B=identify_local_connection
2016-01-08 13:07:32 H=(host.hostingdomainname.com) [127.0.0.1]:34669 sender verify fail for <[email protected]>: The mail server could not deliver mail to [email protected]. The account or domain may not exist, they may be blacklisted, or missing the proper dns entries.
2016-01-08 13:07:32 H=(host.hostingdomainname.com) [127.0.0.1]:34669 X=TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256 CV=no F=<[email protected]> rejected RCPT <re[email protected]>: Sender verify failed
2016-01-08 13:07:32 H=(host.hostingdomainname.com) [127.0.0.1]:34669 Warning: "Detected session with all messages failed"
2016-01-08 13:07:32 H=(host.hostingdomainname.com) [127.0.0.1]:34669 Warning: "Increment slow_fail_block Ratelimit - (host.hostingdomainname.com) [127.0.0.1]:34669 because of all messages failed"
2016-01-08 13:07:32 SMTP connection from (host.hostingdomainname.com) [127.0.0.1]:34669 closed by QUIT
2016-01-08 13:07:32 1aHcNn-00000g-Ve ** [email protected] R=deliver_local_outside_jail T=remote_smtp H=127.0.0.1 [127.0.0.1] X=TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256 CV=no: SMTP error from remote mail server after RCPT TO:<[email protected]>: 550-Verification failed for <[email protected]>\n550-The mail server could not deliver mail to [email protected]. The account or domain may not exist, they may be blacklisted, or missing the proper dns entries.\n550 Sender verify failed
Next, I tried altering the PHP script to use the "-f" parameter to set the sender to an actual email account on the domain "mydomain.com."
After altering the script, I ran it again via SSH using the same command as above, and the mail went through just fine, with the following output in exim_mainlog:
Code:
2016-01-08 13:12:57 cwd=/home/username/public_html/test 4 args: /usr/sbin/sendmail -t -i [email protected]
2016-01-08 13:12:57 1aHcT3-00000f-7s <= [email protected] U=username P=local S=549 T="PHP Mail Test" for [email protected]
2016-01-08 13:12:57 cwd=/var/spool/exim 3 args: /usr/sbin/exim -Mc 1aHcT3-00000f-7s
2016-01-08 13:12:57 SMTP connection from [127.0.0.1]:38366 (TCP/IP connection count = 1)
2016-01-08 13:12:57 1aHcT3-00000f-7s [127.0.0.1] SSL verify error: certificate name mismatch: "/OU=Domain Control Validated/OU=EssentialSSL/CN=host.hostingdomainname.com"
2016-01-08 13:12:57 SMTP connection identification H=localhost A=127.0.0.1 P=38366 U=mailnull ID=47 S=mailnull B=identify_local_connection
2016-01-08 13:12:57 1aHcT3-0005hH-KT <= [email protected] H=(host.hostingdomainname.com) [127.0.0.1]:38366 P=esmtps X=TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256 CV=no S=829 [email protected] T="PHP Mail Test" for [email protected]
2016-01-08 13:12:57 1aHcT3-00000f-7s => [email protected] R=deliver_local_outside_jail T=remote_smtp H=127.0.0.1 [127.0.0.1] X=TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256 CV=no C="250 OK id=1aHcT3-0005hH-KT"
2016-01-08 13:12:57 1aHcT3-00000f-7s Completed
I have a workaround, since adding the "-f" parameter to all my scripts got my emails going through once more, and I all the web software that can to use email via SMTP, which also works, but I'm still curious what I did that caused this.
So, I have two questions. First of all, what setting in my Exim configuration would account for the failure of mail to go through when a script is run via SSH or cron, but to succeed when it's run via a browser going to the same script? Second, why the "SSL verify error: certificate name mismatch," when my service SSL certificate appears to be working fine otherwise?