This wasn’t intended to be my first post, but I just finished getting email working for this blog, so I figured why not post how I got it work. We can always do an intro later.

For this blog and another blog I just started,, I setup a Linux server to host the sites using Apache. After getting the sites setup, I went to setup a couple security plugins that send email alerts. Unfortunately, emails were not working.

Being a fairly recent adopter of Linux, these type of issue are never light bulb moments for me. It takes hitting up Google for the answers. Typically, I scour the web for a couple hours trying pull enough pieces together to get the puzzle put together. This was no different.

In order to save you the time that I wasted, let me just post the steps I did to get this working.

First, I immediately figured I didn’t load sendmail, since I loaded a barebones linux install for this server. So, first step is to load Sendmail.

Install Sendmail:

  1. Since I’m running CentOS, I installed sendmail with “yum install sendmail”.
  2. Next, I set the service to start automatically with the “chkconfig sendmail on” command.
  3. Lastly, start the service with “service sendmail start”.

Alright, send mail is loaded and allows local host by default. Let’s go test these emails again….. nope. Still not working. I was getting the error “Could not instantiate mail function”.

I went to check the logs in the file /var/log/maillog and found the error…

NOQUEUE: SYSERR(apache): can not chdir(/var/spool/clientmqueue/): Permission denied

The problem now is SELinux. You can test and resolve this issue via the following commands:

  1. Check to see if httpd can sendmail by running “getsebool -a | grep mail”
  2. See if “httpd_can_sendmail –> on” shows. If it says off, SELinux is blocking httpd from initiating sendmail.
  3. Run “setsebool -P httpd_can_sendmail on” to fix SELinux.

You should now be able to send emails via WordPress’s, well really PHP’s mail() function.