Email newsletters fall into the “necessary evil” category, in my opinion. I use them here on this blog, and I have clients who want and/or need them for their websites, but what a pain to get working right, especially with WordPress.
Yeah, I know, I could use, and have used, MailChimp or one of the other heavy hitters, but I’m stubborn enough to want this to work with WordPress, and not have to depend on an email service like MailChimp.
MailPoet, SendPress, or Sendy?
I’m going to stick my neck out and say that the only real contenders in the WordPress email newsletter arena are MailPoet (formerly Wysija) and SendPress. You don’t have to agree with me on that one, but this is my blog. 🙂
I currently use MailPoet on this website, though their security snafu in mid-2014 didn’t make me too happy. Everybody makes mistakes, and to their credit they fixed that problem in a timely manner.
I purchased, tried, and still want to like SendPress. Neither MailPoet nor SendPress follows the WordPress admin API very well, but I think SendPress does a better job than MailPoet with their admin. The guys behind SendPress seem motivated, though their version iterations come and go in waves, which is to be expected with a group of guys who also have day jobs – can’t blame them for that! My main problem with SendPress is that their version releases tend to be buggy, and while they usually push out a fix in a short time, I need something I can use with paying clients that’s more dependably professional.
Sendy seemed like a good stand-alone, separate-from-WordPress option. I purchased and installed it on my server, set it up for one of my ecommerce clients, worked up a responsive template, and sent out an email campaign. I have no complaints with how Sendy performs, but it doesn’t integrate (yet?) with WordPress, and that is still a problem.
Needed to make a decision
My current client project is for a large corporation that sends out press releases, SEC filings, and other items on a regular (monthly?) basis, and they’ve asked about notifying their investors via email when these items are published. That project is quickly drawing to a close so I needed to make a decision, and after weighing all the pros and cons, I finally chose MailPoet for this project.
MailPoet does a good job of setting up and sending automatic emails (newsletters) for posts and other custom post types. In this case I set up three different email lists, one each for regular posts and two custom post types. Nice!
Then I started testing the emails and, as I expected, they were not “responsive,” meaning they didn’t look so good on my Android phone, and they looked even worse on my wife’s iPhone 6. MailPoet has been saying for a year or two now that responsive templates are coming, though I can’t imagine why it would take so long to integrate. Time to dig in to the code and see what we can do about this.
Easier than I expected it to be
There is (was) a thread on the MailPoet UserVoice forums that has to do with the lack of a responsive email template, and one of the commenters listed all the files she had to modify to achieve a responsive template. The problem with this approach, as you probably know, is that your modifications won’t survive a plugin update. As I write this post MailPoet is currently at 2.6.15.
I wanted to make this easy on my future self, so after looking through the plugin and reading some code, I selected email_template.html, made a few changes, sent out a test email, and there it was, a mostly responsive email. I say mostly because if you want to do a better responsive job with images you should probably modify the css.html file too.
What needs to change
MailPoet thinks, or thought, that an email should be 600 px wide, no matter what device the email is being viewed on. I, and many others, disagree. So what you’ll need to change are six instances where they set the table width at 600, and change those to 100%. You’ll also want to change style=”min-width:600px;” to style=”max-width:600px;width:100%;” in the td tags, and add max-width:600px; to the main table tag inline style.
Images can be dealt with, more or less, by adding max-width:100%; to the img rule in css.html.
I’ll include the modified email_template.html and css.html files in their respective Gists in this post. You can just copy my code over to your files, though it wouldn’t hurt to read through the code, see what changed, and file it away in your memory.
The two files that need to be modified are:
The Caveat: There had to be one, and it is that I’m using the default email theme. If you’re using something else, you may need to alter these directions. In other words, your mileage may vary.
Bonus: What about HTML tables in the emails?
My client occasionally sends out financial data in their press releases, using HTML tables, and those really needed to be in the emails also. MailPoet was stripping out the table, tr, td, and th tags, and fortunately they provide a filter to alter what is stripped out of your emails. That filter is mpoet_strip_tags_ignored, and you can find it in wysija-newsletters/helpers/articles.php. As a bonus I’ll include a Gist for that too.
The HTML tables aren’t responsive, but I’m okay with that at this point since the majority of the time there won’t be tables in the emails.
Add the filter code to a core functionality plugin (best choice), its own plugin, or functions.php.