Can't Send Email from PHP Script on Macbook Pro M1 Webserver
I have a PHP-based website running on a remote Linux webserver that sends email fine, but my development machine is a Macbook Pro M1 which I've set up as a webserver using Homebrew Apache/httpd/nginx. Everything works fine except email. I use the PHP mail function.
If I understand correctly, mail on MacOS is handled by postfix (the MacOS mail app depends upon an outside service like gmail or the cloud). Using terminal as superuser I checked the postfix status:
% postfix status
postfix/postfix-script: the Postfix mail system is not running
So I started it up:
% postfix start
postfix/postfix-script: starting the Postfix mail system
% postfix status
postfix/postfix-script: the Postfix mail system is running: PID: 29329
I next tested mailx on the terminal command line, but that didn't work either:
% echo "Hello World" | mailx -s "Test email mailx" email@evcforum.net
I also tried sendmail, which also didn't work:
% echo "Subject: Email Test
>
> Email Body" | sendmail email@evcforum.net
The above works fine from a bash shell on my Linux server.
I searched the Internet for solutions, and not finding any I contacted Apple Support. They said that while they'd like to help, this was outside of their range of support, so I'm checking here to see if anyone can help me send email, first from the terminal command line, but eventually from PHP.
I have a related problem where I cannot make postfix start at boot time. The "launchctl list" command lists a couple postfix daemons, and I issued these commands:
% launchctl enable system/com.apple.postfix.master
% launchctl enable system/com.apple.postfix.newaliases
But upon reboot postfix is not running:
% postfix status
postfix/postfix-script: the Postfix mail system is not running
So I need some help with launchctl and the postfix daemons, too.
[Email Edited by Moderator]
MacBook Pro Apple Silicon