MacOS – Is it possible to change the from address on Mac OS X server email alerts

macososx-serverserver.app

I have enabled email notifications in Server.app (2.2.4) on Mac OS X server (10.8.5)

If port 25 is not being blocked at the local firewall or the ISP, this generally works ok.

I've found that if it is being blocked by the ISP, you can go the mail settings within server.app, and set mail to route all mail traffic through ISP and specify your ISP's SMTP gateway, even if you don't actually have the mail server enabled and/or use the mail server.

The problem that I've run into is that I have a client who uses an email hosting provider that requires a valid MX record for the domain that an email is coming from.

Their admin@companyname.com where they want to receive their Mac OS X server alerts cannot receive the alerts because the messages are seen as coming from an invalid domain with no MX record.

The Mac OS X server is called macminiserver01.local or macminiserver01.private and when the email alerts are sent out from server.app, the from address becomes root@macminiserver01.local or root@macminiserver01.private.

Is there a way to manually change the from address so that it is valid?

Best Answer

I know this question is a few years old, but I had the same issue some up today. I resolved it with help from this post:

https://www.cyberciti.biz/tips/howto-postfix-masquerade-change-email-mail-address.html

This was on a Mac server that did not have mail enabled. Apparently even with postfix disabled, the alerts function fires it up just long enough to send the alert email and then closes it again. Running nettop while sending the test alert email lets you see sendmail kick off, followed by postdrop, master, pickup and qmgr.

I found five different locations for the main.cf file file, but the one that seemed to be active was located in:

/Library/Server/Mail/Config/postfix

Edit that file to append this line:

smtp_generic_maps = hash:/Library/Server/Mail/Config/postfix/generic

Then edit generic by appending the mapping you want:

alerts@server.local alerts@validdomain.com Then run:

postmap /Library/Server/Mail/Config/postfix/generic