Skip to content

Configuring the mail server

Jaakko Luttinen edited this page Feb 18, 2018 · 2 revisions

Disclaimer: The author of this page has no experience with mail servers so the configuration may contain serious flaws. Use at your own risk.

By default, Salmon runs as an LMTP server. This means that it needs an SMTP gateway server to receive and queue emails from the outside world. These instructions describe how to configure Salmon and Postfix on the same server for this kind of setup.

Salmon

For sending email, put the SMTP settings you want to use as a relay. Typically, ISPs are blocking outgoing port 25 so you cannot run an SMTP server to send emails on your personal server. Therefore, you probably need to use your ISP SMTP or some other personal email account settings. Also, it is recommended to enable SSL or STARTTLS. Thus, your settings could look something like:

{
    "host": "mail.example.com",
    "port": 465,
    "username": "johndoe",
    "password": "foobar",
    "ssl": True
}

For receiving email:

{
    "host": "localhost",
    "port": 8823
}

Postfix

Installing and configuring Postfix is out of the scope of these instructions. These instructions only provide those bits that are relevant to work together with Salmon.

/etc/postfix/main.cf should include lines similar to these:

# Hostname from the MX record
myhostname = mail.example.com

# Relay all @example.com emails to Salmon
relay_domains = example.com
relay_transport = lmtp:127.0.0.1:8823

If you don't want to use Postfix for any local mailboxes (e.g., it only forwards email to Salmon, nothing else), you can disable local mail delivery:

# Disable local delivery
mydestination =
local_recipient_maps =
local_transport = error: local mail delivery disabled

TODO/FIXME: Perhaps should add support for SSL/TLS so that emails can be received securily? How to configure that?

Finally, you need to open port 25 from your firewall (and configure port forwarding if behind router).

Clone this wiki locally