Setup with postfix


Install postfix and dependencies


Run the following to ensure that postfix and all necessary dependencies are installed:


apt-get update
apt-get -y install postfix sasl2-bin openssl bsd-mailx


If prompted with a dialogue, to choose a Postfix Configuration, then select "Internet with smarthost", and when prompted, enter outbound.ouemfi.com as the smart host (You'll adjust it below anyway).


Edit /etc/postfix/main.cf


Edit /etc/postfix/main.cf and append the following lines to the bottom of the file (if there are duplicate config directives, these will supercede earlier directives):


### BEGIN Add content for ouemfi.com
relayhost = outbound.ouemfi.com
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/password
smtp_sasl_security_options = noanonymous
smtpd_sasl_authenticated_header = yes
smtp_tls_security_level = encrypt
### END Add content for ouemfi.com


Save and exit /etc/postfix/main.cf.

Edit /etc/postfix/password

Edit /etc/postfix/password (this may create an new file), and add the following at the bottom of the file, where YourUsername and YourPassword match those provided to you:


### BEGIN Add content for outboundemailfilter.com
outbound.ouemfi.com    YourUsername:YourPassword
### END Add content for outboundemailfilter.com


Save and exit /etc/postfix/password.

Apply config

Run the following to compile /etc/postfix/password into a "map" which postfix can use:


chmod 0600 /etc/postfix/password
chown root:root /etc/postfix/password
postmap hash:/etc/postfix/password


If you see a warning about a config directive overriding an earlier entry, this indicates that some of the config you pasted into main.cf (above) overlaps existing config. Postfix will honor the last directive it received, so these overlaps will not impact functionality, but you could clean up /etc/postfix/main.cf to avoid the error.

Here's an example of a (harmless) config overlap:


root@ubuntu-bionic:~# postmap hash:/etc/postfix/password
postmap: warning: /etc/postfix/main.cf, line 47: overriding earlier entry: relayhost=
root@ubuntu-bionic:~#


Restart postfix

Run /etc/init.d/postfix restart to restart postfix

Send test email

From the command line, you can send a test email to yourself, by running the following (replacing <your-email-address> with a real one):


echo "Hello, I am your test" | mail -r <your-email-address> -s "Test email via outboundemailfilter.com" <your-email-address>


Check the contents of /var/log/mail.log to confirm successful delivery

Here's an example of what a successful email delivery might look like:


Mar 23 00:57:43 ubuntu-bionic postfix/smtp[3932]: D5C7B3E907: to=<[email protected]>, relay=outbound.ouemfi.com[54.69.62.154]:25, delay=3.1, delays=0.04/0.04/2/1, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as a94db0b3-4d06-11e9-9a10-d1cb19a74d67)
Mar 23 00:57:43 ubuntu-bionic postfix/qmgr[3703]: D5C7B3E907: removed