Allowing httpd to send mail in a selinux environment

Ran into this problem with a new linux installation, the contact forms that were migrated to a new host stopped working. In the end, the cause was selinux and httpd not being authorized to send email.

Checking this is pretty trivial, first see if it's allowed:

$ getsebool httpd_can_sendmail
httpd_can_sendmail --> off

Since this is disabled, we can allow it with this command:

$ sudo setsebool -P httpd_can_sendmail 1

Then verify the change took:

$ getsebool httpd_can_sendmail
httpd_can_sendmail --> on

That should be it. You can verify that it took by running this quick snippet from the command line:

echo test | sendmail -v