MailPress is the most powerful free self-hosted automatic newsletter and mailing list package for WordPress. If you don’t believe me see my [intlink id=”317″ type=”post”]comparison with other WordPress newsletter plugins[/intlink].

If you have a blog with many subscribers, you don’t want to spend time handling bounce messages from readers who fall off the face of the earth, or from spammers who subscribe bad addresses for reasons that make no sense to me. To combat this, MailPress handles bounce messages automatically for you; but it can be a little tricky to set up.

MailPress has two different methods for handling bounce messages. The one described here uses a technique called Variable Envelope Return-Path (VERP) to identify where the bounce messages are coming from. The downside of this technique is that it relies on an address encoding trick that requires a mailbox which will catch all email addressed to a range of bounce addresses. Not all hosting services support this, and even on those that do I think the other method of [intlink id=”781″ type=”post”]bounce handling without using VERP[/intlink] is better; so I recommend you use that instead.

But if you really want to use VERP, here’s a step-by-step guide to configuring it:

Create A Mailbox to Receive Bounce Messages

The simplest way to catch VERP bounce messages is to create a catch-all mailbox. If your hosting package uses CPanel, use Email Accounts on the Mail menu to create a mailbox named bounces@yourdomain, and assign it a password with the password generator. Note this password down as you’ll be using it later.

Then select Default Address on the Mail menu and Send all unrouted email for yourdomain, selecting Forward to email address: bounces@yourdomain (the mailbox you just created).

Unfortunately this option will capture all email to your domain that isn’t addressed to an existing mailbox, including messages to bad addresses that should really generate a failure notice back to their sender. If one of your friends mistypes your name, they’ll never find out now. It would be better if you could specify a regular expression pattern that only captured messages to addresses beginning with bounces… but that seems impossible in CPanel, and MailPress doesn’t yet support any other form of bounce address identification other than VERP.

Check that the default address works by sending a test email to bounces+42+69@yourdomain. Log into Webmail with the address bounces@yourdomain, and check that the test mail is in the inbox.

If you’re with HostGator, you’ll need to start an online chat session and ask the technician to enable the Default Address option, as it is disabled by default.

Activate and Configure The Bounce_handling Add-On

On the WordPress dashboard, select MailPress Add-Ons under the Plugins menu.

Activate the Bounce_handling add-on.

Click Settings underneath Bounce_handling to go to the MailPress Settings page opened at the Batches tab.

Under Handling Bounces set:

  • Return-Path: bounces@yourdomain, the name of the mailbox you created earlier.
  • Max bounces per user: 3.
  • Bounce in mailbox: delete.
  • Submit Batch with: other. And take a note of the sample path which is something like: /home/username/public_html/wp-content/plugins/mailpress/mp-content/xtras/mp_bounce_handling. You’ll need this later too.
  • Save Changes.

Then switch to the POP3 tab under MailPress Settings to configure the bounce mailbox as:

  • POP3 Server: mail.yourdomain
  • Port: 110
  • Username: bounces@yourdomain, the name of the mailbox created earlier. Note that low-cost hosting providers like HostGator use a shared email server where the username includes the domain name.
  • Password: the password you generated earlier.
  • Save Changes.

Enable Bounce Logging

Under Settings, MailPress choose the Logs tab, and select Bounces Logging Level: E_ALL, Number of Bounces log files: 7, which will keep the log for a week.

Set Up A Cron Task To Run Bounce Handling Daily

On your CPanel Advanced menu, choose Cron jobs.

Check that the Cron Email address is set to an address that you read regularly.

Under Add New Cron Job, choose Common Settings: Once a day.

Command: path-to-php -f sample-path-from-earlier/cron.php >/dev/null

On HostGator for example this looks like: /usr/bin/php -f /home/username/public_html/wp-content/plugins/mailpress/mp-content/xtras/mp_bounce_handling/cron.php >/dev/null

This command must be all on one long line.

The purpose of the >/dev/null is to discard the output of the cron job so you don’t routinely receive pointless emails. I recommend you test this initially by omitting the >/dev/null, and checking that you get an email when the job runs. Temporarily change the job to run more often while you’re testing. If all is working, you should receive an email containing a ‘1’. Add the >/dev/null later once you’ve checked everything is working so you don’t end up with a useless daily email.

Test It

If you don’t already have bad addresses subscribed to your newsletter, add one manually using Mails, Users, Bulk Add (click the box at the bottom of the list) and selecting Activate. Post as many articles to your blog as you specified in Max bounces per user earlier, and wait for them to be sent to the bogus address(es).

Check The Logs

After the cron job has run at least once, you can check the bounce processing log in MailPress under Mails, Logs and looking for Name: MP_Log_x_MP_Bounce_mp_process_bounce_handling_yyyymmdd.txt

Examine the log and check that MailPress is establishing a connection to the mail server correctly, reading the bounce messages and marking the offending user as bounced once the specified number of bounces has been reached.

If the log file shows -ERR Authentication failed when connecting to the mail server, double check that you included @yourdomain in the Settings, MailPress, POP3, Username field if you’re on a shared email server. Also check that you pasted the password correctly.

W3-Total-Cache Users Note

There is a problem running cron jobs using W3-total-cache, which you can fix in MailPress 5.0.1 by adding this line to cron.php:

<?php define('DOING_CRON', true);
...

This issue is already fixed for you in MailPress 5.1 and later.


Graham

I'm the creator of BuildYourBlog.net.

9 Comments

Valerie · August 30, 2011 at 10:44 am

Great instructions. I haven’t set up MailPress in a while and didn’t want to bother to figure it all out myself again.

Now that 5.1 is out and an update to W3 total Cache is out as well, do you know if we still need to make the tweak on the cron?

Ovidiu · August 10, 2011 at 11:30 am

just wanted to add a bit of information I just figured out:

if your mail server has set the `recipient_delimiter = +` the bounces will properly end up in the original sending email’s inbox since mailpress adds parameters via + to the reply to address => you don’t need to deal with the spam of a catch all mailbox.

Matthew · July 18, 2011 at 2:14 am

Great plugin! Just one issue I’m having… my test emails keep failing… I use GoDaddy and not sure how to configure my POP SMTP settings… PLEASE help!!

    Graham · July 18, 2011 at 4:51 pm

    Try selecting the MailPress Add-on Connection_php_mail. Then you don’t have to configure SMTP settings. The settings in the POP tab are for your bounce email box.

Ovidiu · April 14, 2011 at 4:52 pm

oh and btw, I tried both from the commandline:

a) wget http://..myurlto/cron.php and
b) php -f /mypathto/cron.php >/dev/null

now checking the usual php error logs to see if anything is going wrong, any other logs to check? since its not running as cron yet those shouldn’t be important…

Ovidiu · April 14, 2011 at 12:54 am

can you help me with this?
I tried manually running it via ssh:

h1870666:/var/www/knightsenglish.com/web# php -f /var/www/clients/clientxx/webxx/web/wp-content/plugins/mailpress/mp-content/xtras/mp_bounce_handling/cron.php >/dev/null
PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 491520 bytes) in /var/www/clients/clientxx/webxx/web/wp-content/plugins/wp-slimstat-ex/lib/track.php on line 662
h1870666:/var/www/knightsenglish.com/web#

not sure which php.ini variable this thing breaks upon… one with 32M but the only one with 32m is max_upload_file_size???

can I also open the cron.php in a browser? that should also trigger it, right?

    Graham · April 14, 2011 at 10:00 am

    You need to either increase your PHP memory_limit in php.ini, or disable some plugins; it’s failing on wp-slimstat-ex, but that could just be the one that pushes it over the edge. Contact the help desk on your hosting provider. No, I don’t think you can just open cron.php in a browser.

      Ovidiu · April 14, 2011 at 4:44 pm

      my memory limit is 128M the error is talking about 33554432 bytes exhausted and none of my variables is limited to 32M !?

      ah, I found the CLi php.ini was set to -1 🙁 changed that to 128M now /etc/php5/cli/php.ini

      got it to run finally! now lets wait for its logs. thx.

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.