How To Send Email From the Command Line on MacOSX 10.10.5 Yosemite

Published Date Author: , Posted January 29th, 2017 at 9:44:55am

myszaI wanted to send email from cron for various reasons, but the emails would bounce with an error 554:
554 5.1.8 : Sender address rejected: Domain not found

Clearly, Postfix was using the “internal” hostname of myappledesktop.local (MacOSX has TWO hostnames! also, myappledesktop.local is not the real hostname ;-).

So, I needed two things:
1. a public FQDN in DNS that mail servers could see and resolve properly
2. to set the sending hostname to that FQDN

For the first, I used my DNS server to create a FQDN with home’s public IP address: myappledesktop.thewyz.net

Then, I edited the Postfix configuration file and set the sending hostname manually:

1
2
vim /etc/postfix/main.cf
myhostname = myappledesktop.thewyz.net
vim /etc/postfix/main.cf
myhostname = myappledesktop.thewyz.net

That did the trick!

No need to run `postfix reload`, since postfix only runs on-demand, not as a daemon.

As always, YMMV…

No comments as yet.

Leave Your Comment  Leave a comment

All fields marked with "*" are required.