SELinux Blocking SMTP

So, I ran into an interesting issue today where SELinux in “enforcing” mode was blocking outgoing SMTP from a web application. I figured it was a variable in the SELinux booleans (configuration options). Setting these correctly fixed the problem (but I did disable and re-enable SELinux on both sides of the solution):

# sudo setenforce 0
# sudo setsebool -P httpd_can_sendmail on
# sudo setsebool -P httpd_can_network_connect on
# sudo setenforce 1

Special thanks to the full list of SELinux booleans on the CentOS Wiki –