Title: Configuration of OpenSMTPD to relay mails to outbound smtp
server
Author: Solène
Date: 06 September 2018
Tags: openbsd70 openbsd opensmtpd highlight
Description:
In this article I will show how to configure OpenSMTPD, the default
mail server
on OpenBSD, to relay mail sent locally to your smtp server. In pratice,
this
allows to send mail through "localhost" by the right relay, so it makes
also
possible to send mail even if your computer isn't connected to the
internet.
Once connected, opensmtpd will send the mails.
All you need to understand the configuration and write your own one is
in the
man page [smtpd.conf(5)](http://man.openbsd.org/smtpd.conf). This is
only a
highlight on was it possible and how to achieve it.
In OpenBSD 6.4 release, the configuration of opensmtpd changed
drasticaly, now
you have to defines rules and action to do when a mail match the rules,
and you
have to define those actions.
In the following example, we will see two kinds of relay, the first is
through
smtp over the Internet, it's the most likely you will want to setup.
And the
other one is how to relay to a remote server not allowing relaying from
outside.
**/etc/mail/smtpd.conf**
table aliases file:/etc/mail/aliases
table secrets file:/etc/mail/secrets
listen on lo0
dataswamp.org:70 /~solene/article-openbsd-opensmtpd-relay:42: port field too long