Open main menu

Aram's Wiki β

Changes

OpenSMTPD forward to Google

997 bytes added, 10:24, 22 February 2019
Created page with "== Introduction == We'll use [https://www.opensmtpd.org OpenSMTPD] to forward to Google. == Prerequisites == A Gmail/Google Apps account. OpenSMTPD is already installed and..."
== Introduction ==

We'll use [https://www.opensmtpd.org OpenSMTPD] to forward to Google.

== Prerequisites ==

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

== How ==

Enable access to what Google calls [https://myaccount.google.com/lesssecureapps less secure apps].

Then as root:

echo "'''googlemail''' user@gmail.com:''password''" > /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://'''googlemail'''@smtp.googlemail.com:587 auth <secrets>

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

Notice the '''googlemail''' label.

Then just restart smtpd:

rcctl restart smtpd

== Test ==

echo "Does it work?" | mail -s "Mail test from OpenBSD" spam@mgk.ro