jbx
By:
jbx

Outgoing email server for Wordpress Newsletter

December 24, 2014 2.6k views

I am considering migrating a client's Wordpress installation from a shared hosting setup to a Digital Ocean Ubuntu/LAMP/Wordpress droplet. However I am concerned about the setup needed for handling email.

Apart from a couple of email addresses on the domain, which could be handled by a separate email provider like Zoho, Gmail/Google Apps, or Microsoft Outlook 365, the client also uses a Wordpress Newsletter plugin, which manages the subscriber list and also auto-populates the newsletter with the latest posts (due to this feature it needs to be integrated into wordpress).

From the information here it is not recommended to run your own full email server on a DO droplet.

On the other hand I could go for a send-only server, like Exim, as described here however I am worried about DO's IP addresses being flagged as spam originators. It seems to be an issue users encounter.

What is the best solution to support this without running risks of over maintenance of mailserver components and also not having such emails flagged as spam?

8 comments
  • One option would be to set up your outside email service and then use a Wordpress plugin that supports sending via SMTP. This way you could simply configure the plugin to use your Zoho/Gmail/O365 service.

    Alternately you could install postfix on your droplet which by default would allow the php mail() function to send without opening the service to outside connections. You would then just need to ensure you have set up appropriate SPF records for the droplet.

  • Would the SPF records help minimise the risk of legitimate emails (which subscribers have subscribed to) being marked as spam?

  • someone posted earlier about using Mandrill http://mandrill.com/

    this looks promising for Newsletters because they will send the first 12000 emails each month for free.

    If I were setting up a newsletter for a client, and they had a large email list (over 1000) I would try out Mandrill for sending the Newsletter.

    As a side-note: One newsletter plugin I was trying was causing some crashes on my droplet. After some de-bugging I found that the newsletter was using wp-cron, which was crashing apache. I had to move it off of wp-cron and run the script from a system cron, which solved the problem.

  • @sierracircle Mandrill seems to be a very interesting solution! I suppose they are like SendGrid and take care of verifying their clients and avoiding being marked as Spam. The Wordpress Newsletter plugin I am using at the moment supports custom SMTP settings so it should not be an issue to use that.

    What was the issue you were facing with your newsletter plugin? Do you remember which one it was? Its quite strange that a PHP script manages to crash Apache, normally PHP errors are contained quite well. I guess running the script using a system cron is better anyway, and pretty easy to do.

  • @jbx if you do end up using Mandrill could you post your experience? I would be curious to know how well it works. It does look like they handle the verification and such, so that would be one less thing to worry about.

    The newsletter plugin I was using is MyMail

    Which I like, but just the issue of wp-cron crashing things. There is a setting to use system cron rather than wp-cron, so it was easy to switch over.

    No problems since then, but the client has a fairly small mailing list (around 600), so it has not really been put under a heavy load yet.

  • @sierracircle Sure. I am still evaluating options and migrating to DO seems to be the preferred option. I am working out these small details like the email setup before I could recommend this as the way forward.

    Regarding wp-cron, you should actually be able to disable it from being invoked with each page hit with define( 'DISABLE_WP_CRON', true ); and then call it separately when you want using a normal system cron job, with something like */1 * * * * curl -I http://www.yourdomain.com/wp-cron.php although I don't know if it needs some GET parameters.

  • yep, that is almost exactly what my cronjob looks like except I run it from a script like:

    #!/bin/bash
    curl --silent http://thedomain.com/wp-content/plugins/myMail/cron.php?f7499484849
    exit 0
    
  • I am using postfix on DO to send outbound email. Incoming email is forwarded to a gmail account so I don't have to manage any local mailboxes on my DO server. I have had no issues with mail going to SPAM as long as the SPF record is set up correctly.

1 Answer

This question was answered by @ryanpq:

One option would be to set up your outside email service and then use a Wordpress plugin that supports sending via SMTP. This way you could simply configure the plugin to use your Zoho/Gmail/O365 service.

Alternately you could install postfix on your droplet which by default would allow the php mail() function to send without opening the service to outside connections. You would then just need to ensure you have set up appropriate SPF records for the droplet.

View the original comment

Have another answer? Share your knowledge.