Problem:
After rebuilding a CentOS 7 system with a Laravel app on it, every time the app attempted to mail a notification using MailTrap, the above error got fired.
Solution:
SELinux. Again. It’s always flipping SE LINUX! The SELinux policy can block in and outbound ports and all sorts of things. It’s a git. A clever useful git.
Running `sudo sealert -a /var/log/audit/audit.log` showed the problem. If sealert isn’t possible, then tailing the audit log with `sudo tail -f /var/log/audit/audit.log` goes some way to finding the problem.
In this case a solution (being Linux there are probably 74 equally effective and largely contested solutions) was to allow Apache to use port 2525 like so:
sudo semanage port -a -t http_port_t -p tcp 2525
Any good? If this helped please let me know: