Office 365 Setup

You need to rewrite the header to overwrite any address with your Office 365 user. I also have this from my notes:

Here’s an example of an /etc/postfix/smtp_header_checks configuration that will change the From(header) address of every outgoing message to LOCALHOST System <[email protected]>:

/^From:.*/ REPLACE From: LOCALHOST System <[email protected]>

Please note I’m not a regex expert, so you may want to test your own regex rather than relying on the one above.

After adding smtp_header_checks, the following config option must be added to /etc/postfix/main.cf:

smtp_header_checks = pcre:/etc/postfix/smtp_header_checks

Then reload the postfix config (assuming systemd) and send a test message:

sudo systemctl reload postfix

sendmail [email protected] << EOF Subject: Test email to root. Testing. EOF