How to Configure Your Blog's Newsletter in MailPress

MailPress is the most powerful free self-hosted automatic newsletter plugin for WordPress, according to my detailed comparison of WordPress newsletter plugins. But and all that power can make it a little tricky to configure.

Having a newsletter on your blog allows visitors to subscribe to regular updates via email. An automatic newsletter simplifies the process so that all you have to do is post articles to your blog, and the newsletter to your subscribers is built and sent automatically with no extra effort from you. Even with the advent of RSS feeds and Twitter, email is still the easiest way of getting back in touch with people who have visited your blog before, and giving them a reason to visit again.

So here is a step-by-step guide to configuring your MailPress newsletter:

Install MailPress

If you don't already have MailPress installed, now is the time. Add it just like any other plugin from the Plugin Directory, and enable it.

Enable The Add-Ins

Go to Plugins → MailPress Add-Ons and activate these add-ons, if they aren't active already:

  • Batch_send
  • Bounce_handling
  • Filter_img
  • Newsletter
  • View_logs
  • Tracking_ga or Tracking, depending on whether you want to use Google Analytics or MailPress's built-in click tracking to track click-thru rates in your newsletter.

If you have a complex site and want to create a separate newsletter for each category, also enable:

  • Newsletter_categories

Configure Basic MailPress Settings

Go to Settings → MailPress → General. Under Admin, make sure Dashboard Widgets is selected, and under From check the address that mails will be sent from is correct. If you don't already have a mailbox you read regularly at this address, set it up now.

Go to the Test tab, and check that MailPress can send a basic test email.

Go to the Subscriptions tab, and select whether you want to enable newsletters that send for every post you publish (Per post), Daily, Weekly or Monthly. If you post a lot of articles, I recommend Daily or Weekly. You can enable them all, but the more choices you give your visitors the more likely they will get confused. Don't go overboard here; I recommend you just pick one option.

Make sure the Default box is selected underneath your choice of newsletter: this indicates which newsletter the MailPress subscription widget and shortcode will add subscribers to.

If you have separate newsletters for each category, you need to enable them here. Remember that you have to come back and do this each time you add a new WordPress category; which is one of the downsides of having per-category newsletters.

You'll want to watch your logs for a while to ensure that everything is working: On the Logs tab, for both Newsletter and Batch select Logging Level: E_ALL, Number of Bounces log files: 7, which will keep the logs for one week.

Choose Your MailPress Theme

Under Mails → Themes, choose your MailPress theme. I use a slightly modified version of MailPress Twenty Ten, which matches the WordPress default Twenty Ten theme nicely.

All email sent by MailPress, including your newsletters, will be styled with this theme. This gives a consistent look and feel, or branding if you like, to your visitor's email interactions with the site.

Add MailPress Rules To Your WordPress Theme's style.css

For the MailPress subscription widget to work properly in all circumstances, you need to add some rules to your WordPress theme's style.css. You also need to set a configuration option to insert some JavaScript at the bottom of the page. If you skip this step, you may find situations where the "Loading..." icon keeps spinning indefinitely. To avoid unnecessary grief, implement the changes described in Fix For “Loading...” Keeps Spinning In MailPress.

Disable Normal wp-cron

If you haven't already done so, I recommend that you disable wp-cron from running in the background. Unless you do this, a bug in WordPress's wp-cron can cause your subscribers to receive duplicate newsletters.

Note that if you follow my instructions exactly, you'll end up creating 3 cron tasks for your blog:

  1. To run wp-cron regularly
  2. To schedule your MailPress Newsletter batch processing
  3. To schedule automatic MailPress bounce email processing

Configure Batch Processing

Low cost web hosting services often have rather draconian email policies; they may bounce your email if you send it too quickly (like HostGator do), or they may simply drop it without notifying you (like IX Web Hosting do). They don't really care much about getting email from your site delivered correctly; but there are ways around this.

MailPress sends a separate email to each newsletter subscriber, which allows personalisation and bounce handling to work. Even if your web host allows large numbers of emails to be sent in quick succession, the time taken to send all these emails may exceed your web host's PHP max_execution_time. MailPress attempts to increase this limit, but HostGator sets a rather small hard limit of 30 seconds.

The result of all this is that you almost certainly want to configure batch processing, even if you think at first you don't need to. To do this, go to Settings → MailPress → Batches. The settings I use on HostGator to keep me under the 30 second max_execution_time are:

  • Max mails sent per batch to 20
  • Max retries to 3
  • Submit batch with to Other.

I don't recommend you use WP_Cron, because caching plugins like W3-Total-Cache interfere with it. Even if you disable wp-cron from running in the background, I still recommend you set up a cron task to send each batch of emails so you can vary exactly how often batch processing runs independent of other wp-cron tasks.

Set Up A Cron Task To Send Each Batch

Leave the WordPress admin backend for a moment, and visit your web host's CPanel in a new web browser window. On the 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 an hour. Change the Minute field to a random odd or prime number like 27, so your job doesn't have to compete on the hour with everyone else's.

The Command: must be all on one long line. Use the sample path MailPress gave you when you selected Submit batch with: Other:

path-to-php -f sample-path/cron.php >/dev/null

On HostGator for example mine looks like:

/usr/bin/php -f /home/username/public_html/wp-content/plugins/mailpress/mp-content/xtras/mp_batch_send/cron.php >/dev/null

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 flooded with useless email.

Note that when you enable automatic bounce handling, you'll create another cron command with slightly different parameters. You need them both.

Enable Automatic Bounce Handling

People come and go, and they don't always unsubscribe from your newsletter when their email address drops off the planet. This is bad because it generates bounce messages that can flood your inbox and/or increase the load on your email server without you even being aware of it. Your web host will hate you for this, especially since they didn't care that much about your email in the first place. You'll also think you have more subscribers than you actually do.

The solution is to configure automatic bounce message processing in MailPress.

Add a Subscription Widget

If you want a subscription widget to appear in your sidebar, go to Appearance → Widgets. Grab the MailPress widget and drag it across into one of the widget areas provided by your WordPress theme.

Set a title like Subscribe via Email, and a button text of Subscribe. Enable Manage your subscription link so savvy visitors can change their subscriptions. Leave the Preloaded checkboxes unselected, unless you've hacked your theme and know what you're doing.

You'll also want to style the subscription widget so it looks more appealing.

Create a Subscription Page

If you'd like to have a page to handle newsletter subscriptions, create a static page using Pages → Add New. Title it Newsletter Subscriptions, or something similar. I recommend giving it a simple permalink that you'll remember, like /newsletter.

On the page, include the MailPress shortcode:

[[mailpress]]

Visitors that enter their name and email address will be added to the default newsletter that you configured earlier. Add the newsletter signup page to your menu so visitors can find it, using Appearance → Menus → Pages.

Disable Filters That Generate Bad Email Content

Some WordPress plugins modify the content of your posts in ways that work well on the web, but not so well in email. If you have any such plugins, you need to modify your MailPress theme to disable plugins which generate bad email content. If you want to embed videos in your content, you'll need to workaround poor embedded video support too.

Test It

Subscribe an email address you own that isn't associated with the site to the newsletter, via the widget or the subscription page. Post an article on your blog. Note that since you're using hourly batch processing, it may take up to an hour for the article to show up in your inbox.

Check The Logs

After posting an article and waiting for the batch processing cron job to run, you can check the logs in MailPress under Mails → Logs and looking for Name: MP_Log_x_MP_Newsletter_sched_proc_yyyymmdd.txt and MP_Log_x_MP_Batch_mp_process_batch_send_yyyymmdd.txt

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 is already fixed for you in MailPress 5.1.

Liked this post? Subscribe to get more like it via email.

About Graham

I'm the creator of BuildYourBlog.net.
This entry was posted in MailPress and tagged , . Bookmark the permalink.

53 Responses to How to Configure Your Blog's Newsletter in MailPress

  1. Nick says:

    Hi Graham!
    Thanks for this great tutorial.
    Question:
    I got this email from Cron Daemon:
    /bin/sh: -c: line 0: syntax error near unexpected token `newline'
    /bin/sh: -c: line 0: `/usr/bin/php -f /home3/houstona/public_html/INSHOP/wp-content/plugins/mailpress/mp-content/xtras/mp_batch_send/cron.php >'

    What am I doing wrong?

    Thanks!

    Nick.

  2. Garrett says:

    Graham! Great job with this post -- and with this blog as well!

    I've been able to figure just about everything out that was not working the way I wanted it save one...

    The daily newsletters for posts are going out with summaries instead of full text -- kind of defeats the purpose of affiliate marking for my blog. The Reading Settings is set for Full text yet it still delivers only a summary.

    I'm still a newbie with PHP and I am assuming something in the _loop.php file is cutting it short.... here's what's in the content area of the file...

    <div classes('* entry-content'); ?>>

    <footer classes('entry-footer'); ?>>

    As I already have 100 people on mailing lists, I didn't want to mess around with sending dummy emails out (is there way around this as well?)...

    I believe removing 'the_excerpt' line will only cuase the mails to send the first few lines of the posts as that was what it was doing before I started using the excerpt box recently.

    My first thought was to copy the entire post to the excerpt -- but I thought better... 🙂

    • Garrett says:

      Let's try that again, I'm learning here! 😀

      < / header >< ! -- .entry-header -- >

      < div < ? php $this- > classes ( ' * entry-content ' ) ; ? > >
      < ? php the_excerpt ( ) ; ? >
      < / div> < !-- .entry-content -- >

      < footer < ? php $this - > classes ( ' entry-footer ' ) ; ? > >

    • Graham says:

      I suspect your MailPress theme is using the_excerpt instead of the_content. Note that the_content takes a parameter which specifies the "More..." text. Have a look at the twentyten theme's _loop.php for an example. Cheers, Graham

  3. Thanh lap cong ty Hai Phong says:

    thank for your greate post.

  4. Arjen says:

    How can subscribers edit their name or email address? I see they can unsubscribe or edit their subscribtions, but no option to edit their name or email address.

    Is there an add-on? Or template?

    Thanks!

    • Graham says:

      There's no easy way to do it that I'm aware of; you can't even change it manually without editing the SQL database unfortunately.

  5. Hi Graham I have just started blogging.You gave very nice information I followed your steps and its working good. Thank you

  6. Works just fine for me. Thanks very much for helping me out. I really appreciate it.

  7. Alfons says:

    I set up a cron task to send each batch like you described for newsletters per post, but it's not sending the e-mails. I get this result from the log:

    **** Start logging **** mp_process_batch_send *** level : 8191 **** (5.3) **** /domain/wp-content/plugins/mailpress/mp-content/xtras/mp_batch_send/cron.php

    **** End logging **** mp_process_batch_send *** level : 8191 **** status : TRUE

    Do you have any idea what may cause this problem? The test e-mails go fine.

  8. I've set everything up for the plugin but I'm having problems with mailing lists. I want to set up a small 2-3 person test mailing list but I don't see anywhere to add the emails when I create the mailing list.

    • Graham says:

      There's a tiny field at the bottom of Mails -> All Users which allows you to bulk add users to a mailing list. You need to click inside the field for the options to appear.

      • Kysmor says:

        Hey guys, just FYI:
        I spent some time before understand that the bulk add feature is not part of the default MP plugin, but it's provided by the MP sub-plugin called "Bulk_import".nn1

  9. Simon says:

    Hi Graham,
    I swear I did everything you wrote to configure mailpress on my wordpress. I can't do a test. It always says the same thing when I try to test mailpress : check your logs and settings.

    I have 5 logs and they are all E_ALL. I have 7 add-ons and I ended up with 3 cron tasks.

    Can you help me ?

    I have mailpress 5.3 and wordpress 3.4.2

    Thanks.

    Simon.

  10. Simon says:

    Hi Graham

    Great article.

    I set it up with MP 5.3. WP 3.4.2 and W3 Total Cache

    All worked fine and was great until W3 total Cache was installed when the per post newsletters stopped containing any body content- the email was blank.

    Solution, for now, de-activate W3 Total Cache.

    Just a heads up for everyone that goes down this route.

    • Graham says:

      Hmm... that's interesting. I use MailPress with W3TotalCache and my per-post newsletters are fine. I'm wondering if you're using a special plugin to generate article summaries or if there's some other plugin conflict going on?

  11. Derek O'Dwyer says:

    Hello Graham, I got this message from Cron Daemon but do not know what it means

    /bin/sh: /home/derekod1/public_html/accountantgalway.net/wp-content/plugins/mailpress/mp-content/xtras/mp_batch_send: is a directory

    can you shed any light - I followed your instructions re mail press mailing the posts automatically

    thanks, Derek

  12. Jan Kasal says:

    First, my thanks to the author of this column, as it cleared a lot of issues I didn't know about. No matter how I have set the MailPress, the MP has been always sending emails over the limit allowed by the provider.
    Second, a little clarification that will save newbies, like me, a lot of time: The sample path MailPress gives you when you select "Submit batch with: Other:" is not a complete path, unless it starts with /usr/bin/php -f and ends with cron.php
    It was my case and it took me forever to figure out I had to insert it on the path manually. One more thing, I have to emphasize. You have to get email cron message with a simple "1", anything else in the message is a sign of cron not set up properly.

  13. Andreas says:

    Hi,

    I've used your excellent article for configuring mailpress
    (http://buildyourblog.net/email/mailpress/configure-blogs-newsletter-mailpress), but I have a question:

    By following your article, is it correct that you then send a batch of 20 emails out every 27th minute of the hour (by configuring the C panel CRON job)? I am about to send a newsletter to 4800 recipients, but that will take 240 hours with only 20 emails per hour.

    There must be something I misunderstood here! I am also using Hostgator and will have the same restrictions as you.

    Thanks for your help! Again, great article!

    Andreas

    • Graham says:

      Yes, you're right; if you a lot of subscribers, you'll want to run the cron job more often or increase the batch size. You just have to make sure you don't exceed the maximum rate your hosting provider will allow you to send emails from your account.

      • anina says:

        Thanks for the nice solution Sir. I am very new in bloging. and I have some blog and i added this plugin as follows this step but like Andreas i have also problem in timing during send a newsletter. I just send a newsletter to 1100 recipients and taking time 130 hours. I think i am not exceed my batch size. Tell me How can i Recover this problem and i want to set up a day/time also.
        Thanks

  14. David says:

    Very helpful guide indeed, thank you.

    It did take me a while to figure out that I also needed to enable the Connection_PHP_mail add on, under plugins, before my test mails would send – before that, they failed.

    I'd like to follow your cron instructions, but made the probably bad choice of Ipage.com as a host, and they have a proprietary control panel (not cpanel) and no way of setting up cron jobs. (Note to self: always choose host with cpanel in future.)

    I have a further question – how can one set the day/time when a weekly or monthly email goes out? I am about to start work on another blog/mail project where it's important that a weekly bulk mail goes out on a Monday evening – but I can't see any setting for this in Mailpress.

  15. Jay Patel says:

    How prevalent is the Cron job bug you talked about? If I increase the batch time would the error frequency be reduced?

    Thanks for a great blog post!!

    • Graham says:

      It used to hit me every few newsletters; which was a real pain in the ass. Now that I've disabled WordPress's automatic wp-cron, I don't have the problem any more. Cheers, Graham

  16. Carlos says:

    Just - Thanks you. This is the most cumbersome plugin I have seen. Your guide made all the difference!

    Thanks.

  17. SBI says:

    Hi Graham - I used your guide to set all this up last September with an earlier version of both WP and MP. Just today I have updated both of them to their current versions. Are your instructions for setting up a newsletter still the same with WP 3.3.1 and MP 5.2.1? Is there anything I should be aware of (tweaks, reconfigs, etc.) to ensure this will still work on my next send? I noticed after updating WP that I was getting some pretty funky cron job notifications:
    "failed to open stream: Permission denied in . . . "
    "supplied argument is not a valid stream resource in . . . "
    "Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 1025 bytes) in . . . "
    I assumed I needed to update MP along with it so I did. Anything to worry about with this? Thanks!

    • Graham says:

      I've recently done the same update myself, and had no problems; the instructions should be the same. The Fatal error looks like you're exceeding your PHP max_memory_size which often defaults to 64Mb. Check to see if you have any plugins which are using a lot of memory, and try your hosting service's tech support. Cheers, Graham

      • Graham says:

        Yes, it's MailPress breaking the camel's back all right, but it may not be the main culprit. Or it might; I haven't seen MailPress hog memory in the past. Perhaps if you're using large batch sizes it could be a problem. If your hosting service allows you to alter the PHP max_memory_size, that will get around the problem - try upping it to 128Mb. Otherwise you'll have to work out what plugin is using so much memory in PHP.

  18. naomi says:

    Got it and mind you it really worked out. thanks to you;p

  19. Hi Graham,
    Thank you for this great post.
    All is working for me.
    But, I have a lot of posts on my website and the monthly newsletter is very big (>4Mo).
    How to include only a preview or a summary of each post in the newsletter ?
    Thank you in advance for your help.
    François

  20. Anthony Epes says:

    Hi Graham

    Exactly were is this done on the newly created newsletter page?
    TIA
    Anthony
    "On the page, include the MailPress shortcode:

    [mailpress]"

    • Graham says:

      You just put the text mailpress surrounded by square brackets where you want the signup form to appear in the WordPress page editor. This is called a shortcode. Click Preview, and you'll see the form in its place. Cheers, Graham.

  21. paula says:

    Thank you so much for this tutorial. Now I have a working blogpost subscription! *doesundignifiedhappydance*

  22. I've figured out the addition to the test group mailing list, or at least a workaround. Wish it was included in the edit mailing list option. I'm trying to figure out the opt out option for the emails if someone gets an email and they want to stop the subscription. Where can I find that?

    Thanks,

    C-

    • Graham says:

      Hey Chris. There's a line at the bottom of footer.php in your MailPress theme which says "Manage your subscriptions". I change this to read "Click here to unsubscribe or change your subscription options", so it's clearer for people who get an email and want to unsubscribe.

  23. I've set everything up for the Mailpress plugin but I'm having problems with mailing lists. I want to set up a small 2-3 person test mailing list but I don't see anywhere to add the emails when I create the mailing list. I've looked on the mailpress forum but I don't see anything regarding this. I'm likely missing something obvious but can't find anything.

    Thanks for any help you can give.

    C-

  24. Eric says:

    Should I be getting a "permission denied" message in my email notification? Here is the content:

    /bin/sh: /home/******/public_html/wp-content/plugins/mailpress/mp-content/xtras/mp_batch_send/cron.php: Permission denied

    Also, although I copied and pasted the sample path MailPress gave me, I'm noticing mine looks a bit different than yours. Yours starts with /usr/bin/php -f, whereas mine starts with /bin/sh:

    I am using HostGator, so I assumed they would look similar. Thanks.

  25. SBI says:

    Thanks for providing this step-by-step--very thorough and helpful! My question has to do with the auto-responder confirmation emails that are sent after someone subscribes. I'm using the 2010 theme, and they look fine, but I'd like to modify the text as well as the titles (at this pint it's reflecting my blog name rather than my newsletter name). I'd also like to remove the MailPress footer that appears at the bottom. Any suggestions? Again, thanks!

Comments are closed.