I’m continually amazed by how much hands on effort it takes to run even a small blog or community these days. The SPAM bots are continually spewing their useless garbage everywhere, the hackers and script kiddies are continually trying to break down the front door and somewhere in there is the appreciative reader in search of an answer to his/her question or just genuinely interested in the topic at hand.
Every now and then a genuine (system administration) issue or problem surfaces that deserves some time and effort. Since I’m utilizing a virtual private server (VPS) running CentOS 5.5, I’m responsible for administering and managing the server myself. I was an IBM AIX (long live SMIT) and Solaris System Administrator in a previous life so it’s not a big challenge but it can be a time consuming task. The benefits of managing my own server are still significant enough for me and I’ve learned so much about Linux, MySQL, PHP, Perl, etc. that the experience has been well worth the investment in my view.
I recently noticed that I was getting a lot of bounced email messages on the server from a number of readers that had subscribed to posts on my blog. Here’s a quick snippet of the bounced error message;
Action: failed Status: 5.1.7 Remote-MTA: dns; mx.acme.org Diagnostic-Code: smtp; 550 5.1.7 ... We systematically reject 'apache@...'
It seems that a few domains (example above is acme.org – changed to protect identity) were rejecting any email message with the Return-Path set to apache@hostname. In my case the Return-Path was set to email@example.com although the From address was set to firstname.lastname@example.org. Unfortunately you can’t set (not to my knowledge anyway) the Return-Path from within WordPress administration portal. You need to manually edit wp-includes/class-phpmailer.php and set the variable $Sender to the same email address you setup within WordPress to use as your From address.
/** * Sets the Sender email (Return-Path) of the message. If not empty, * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode. * @var string */ var $Sender = 'email@example.com';
With that change complete I can see from the server logs (/var/log/maillog) that the Return-Path is now being properly set.
Feb 12 08:29:56 michaelfmcnamara postfix/pickup: 2B8FD2C3BB: uid=48 from=<firstname.lastname@example.org> Feb 12 08:29:56 michaelfmcnamara postfix/cleanup: 2B8FD2C3BB: message-id=<email@example.com> Feb 12 08:29:56 michaelfmcnamara postfix/qmgr: 2B8FD2C3BB: from=<firstname.lastname@example.org>, size=1729, nrcpt=1 (queue active) Feb 12 08:29:56 michaelfmcnamara postfix/local: 2B8FD2C3BB: to=<email@example.com>, relay=local, delay=0.07, delays=0.04/0.01/0/0.02, dsn=2.0.0, status=sent (forwarded as 321C72C37A) Feb 12 08:29:56 michaelfmcnamara postfix/qmgr: 2B8FD2C3BB: removed
With that change those domains that were rejecting email from my server are now accepting them again. Just another day where I’ve learned something new.
Update: Thursday February 24, 2011
It seems the upgrade to WordPress 3.1 has overwritten the change I made in the file… had to update the file again!
Update: Friday April 22, 2011
It seems the upgrade to WordPress 3.1.1 has overwritten the change I made in the file again!