Missing WordPress account notification e-mails

I’ve spent several days now trying to get notification e-mails to go out when a new blog user is created.

Finally got it working. I’m posting this in the hopes that anyone with the same problem will be able to find this before going down all the other false leads I found.

For the record, we are running on a Apache server under OpenBSD with php5.3. For improved security the scripts that run in response to web requests run in a subtree of the server’s file system colloquially known as a “jail” but implemented using OpenBSD’s ‘chroot’ facility.

In order to be able to send mail under these circumstances you must have the default shell /bin/sh available in the jail because of some lazy coding in php’s mail() function. Rather than parsing the arguments itself and calling the mailer program using the ‘exec’ system call, it uses ‘popen’ which needs the shell to do the parsing of the command options. So if /bin/sh is not in the jail, the mail() function quietly (as in no informative error message) fails. Furthermore, you have to ensure that the jail contains a mail-sending program suitable for use in such a confined environment; in our case we are using ‘femail’ (which is apparently difficult to find with Google, who insists on spell-correcting your search string to ‘female’).

The hint that this might be the problem this was found here.

Finally, we have some pretty fussy spam-control measures on our SMTP server, so the From address must be valid. To accomplish this I added the ‘Send From’ WordPress plugin, which allows setting the apparent sender of such notifications. In our case it is set to info@papertrail.ca rather than the default ‘wordpress@papertrail.ca’.

Now Audrey actually knows she has a WordPress account and can start posting.

Leave a Reply

Your email address will not be published. Required fields are marked *

*