Tested on OpenBSD 6.4

Forward outgoing mail to a remote SMTP server

Replace smtpd.conf(5), add secrets, set permissions, test the configuration, and restart smtpd(8):

# cat > /etc/mail/smtpd.conf << EOF
table aliases file:/etc/mail/aliases
table secrets file:/etc/mail/secrets
listen on lo0
action "local" mbox alias <aliases>
action "relay" relay host smtp+tls://foo@server:port auth <secrets>
match for local action "local"
match for any action "relay"
EOF
#
# touch /etc/mail/secrets
# chmod 640 /etc/mail/secrets
# chown root:_smtpd /etc/mail/secrets
# echo "foo username:password" > /etc/mail/secrets
#
# smtpd -n
configuration OK
# rcctl restart smtpd
smtpd (ok)
smtpd (ok)
#