This is a relatively complex problem and LONG description, so bear with me. Please ask questions in the comments if you think I can clarify something. I am hosting multiple websites on a single computer running macOS Server (version 5.3.1 running on macOS 10.12.6). On one of these websites, I have a PHP form that is supposed to send me an email when submitted (but doesn't). I have three test platforms: a server at college (heavily regulated enterprise network), a server at home that hosts the website (relatively secured and managed personal network), and a laptop with me while I'm staying with friends abroad (relatively unmanaged, likely less secured, personal network). All three devices are Apple computers with macOS Server set up.
What I know works:
- I have my spam filter set to accept emails from this PHP script.
- PHP is enabled in the Websites section of MacOS Server.
- When I first began building the site (August), the PHP code sent me emails.
- The PHP script (in its current form) works.
- I am currently staying with friends abroad, and if I run this script from my laptop via terminal (
php ~/path/to/script.php) from here, it works.
What I know doesn't work:
- If I fill out the form online the php script does not work.
- Running the script via terminal on the server at my home fails.
- Running the script via terminal on the server at my college also fails.
Note that the PHP mail function returns success every time, even if I never receive an email.
It's these last few points that make me think that the problem is with a firewall. Since I launched the sites (about a month ago), I have had to close a number of service ports I was using when building the sites (screen sharing, ssh, and some others) on the server at home after bots tried to hack it, and was wondering if this could have led to the problem or if it is something entirely different.
Question: Is there a way I can get my PHP mail script to function as expected?
Maybe more useful information: port scans!
Here is an nmap port scan of the public IP of the website:
PORT STATE SERVICE 53/tcp open domain 80/tcp open http 111/tcp filtered rpcbind 311/tcp open asip-webadmin 443/tcp open https 625/tcp open apple-xsrvr-admin
Here is an nmap port scan of my laptop (localhost) (I will try to get a port scan of the public IP of the network soon and add that to the question, but this is not possible at the moment):
PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 88/tcp open kerberos-sec 111/tcp open rpcbind 443/tcp open https 445/tcp open microsoft-ds 464/tcp open kpasswd5 548/tcp open afp 749/tcp open kerberos-adm 999/tcp open garcon 1021/tcp open exp1 1023/tcp open netvenuechat 1947/tcp open sentinelsrm 2049/tcp open nfs 3031/tcp open eppc 3322/tcp open active-net 3323/tcp open active-net 3324/tcp open active-net 3325/tcp open active-net 4444/tcp open krb524 5900/tcp open vnc 7000/tcp open afs3-fileserver 7001/tcp open afs3-callback 49152/tcp open unknown 49153/tcp open unknown 49154/tcp open unknown 49155/tcp open unknown 49156/tcp open unknown 49158/tcp open unknown 49159/tcp open unknown 49160/tcp open unknown 49161/tcp open unknown 49163/tcp open unknown 49167/tcp open unknown