Are you having problems getting email sent from you WordPress blog?

One of the features that I really like is being able to get emails when new comments are posted. I also use the Contact Form 7 plugin which needs to send mail.

The Problem

I recently switched web hosts to Webfaction. They’ve been great — what I think you should be able to expect out of shared hosting. ¬†The only problem is that they don’t support PHP’s mail function. They claim it’s to reduce spam — mail() can be used to send email defining the from address as whatever you want without having to authenticate. It can be very convenient, but it’s really not the ideal way to send mail using PHP anyway. WordPress does it because it’s pretty rare to find a server that doesn’t support it and the alternatives are too commonly uninstalled.

The Solution

To fix this issue we need to find a way to take the email that WordPress wants to send and send them through Pear’s mail function. Pear is a PHP framework much like zend is to PHP or jQuery is to Javascript. The mail function in particular lets us send mail similar to the way the regular mail function does, but we have to authenticate through an SMTP server.

I found a couple of plugins, but decided to use WP-Mail-SMTP.

Since we need to authenticate, there has to be a real email address that the emails are coming from. I setup wordpress [at] mydomain because that’s where the emails would normally come from if you didn’t have this issue. Since I’m using Google Apps for my email I used the author’s instructions for configuring the plugin for Google Apps and it worked perfectly:

Mailer: SMTP
SMTP Host:
SMTP Port: 465
Encryption: SSL
Authentication: Yes
Username: your full gmail address
Password: your mail password

Hopefully this helps. I’m sure there could be other causes to why your ¬†mail isn’t sending, but this is what worked for me. Before you try this, try checking if your host supports PHP’s mail function. If not, this will probably fix it — as long as they support Pear. If they don’t support PHP’s mail function, they most likely support Pear for the same reasons listed here.