OpenSMTPD forward to Google

From Aram's Wiki
Jump to: navigation, search


We'll use OpenSMTPD to forward to Google.


A Gmail/Google Apps account. OpenSMTPD is already installed and running on OpenBSD.


Enable access to what Google calls less secure apps.

Then as root:

echo "googlemail" > /etc/mail/secrets

You can use your Google Apps username instead of gmail, and googlemail is just a label that we will use later.

In /etc/mail/smtpd.conf:

table aliases file:/etc/mail/aliases
table secrets db:/etc/mail/secrets.db

listen on lo0

action "local" mbox alias <aliases>
action "relay" relay host smtp+tls:// auth <secrets>

match for local action "local"
match for any action "relay"

Notice the googlemail label.

Then just restart smtpd:

rcctl restart smtpd


echo "Does it work?" | mail -s "Mail test from OpenBSD"