Mail Server Configuration

Thu, 16 Jul 2020 08:41:14 +0200

Mail Server Configuration

Recently I installed my mail server on 9front. Most of the time I followed the guide in the FQA, but still there are things to explain. In this document I’ll go through the section of the FQA and annotate things.

Right at the beginning the FQA mentions how the executing user needs write permissions for the mailboxes. This is very important! If upas can’t write the mailboxes the mail server will not accept incoming mail!

In my setup I can skip all DNS stuff, because I have my DNS hosted somewhere else. Make sure to add proper MX records as well as (at least) an SPF record.


To make things short, here are the necessary lines in my setup. The server handles authenticated incoming mail for sending to other providers as well as incoming mail for local accounts.


norelay          on

verifysenderdom  on

saveblockedmsg   off


Note that the server is no relay for unauthenticated/untrusted requests, it will still relay if you authenticate.

At this point it might be a good idea to check your user password. Use auth/changeuser to add Inferno/POP secrets to your user accounts. Use these passwords to authenticate to the smtp server.


The program that handles sending mail uses this file to rewrite mail addresses. This file is responsible for filtering out local mail as well as sending other mails to the mailer.

In my setup I added three aliases:

pOsTmAsTeR    alias postmaster

aBuSe         alias abuse

wEbMaStEr     alias webmaster

Use regular expressions to define your domain:

\l!(.*)                alias \1

\l\!(.*)   alias \1!(.*)       alias \1

For translating mails I added one more rule for mail address tags. These tags are in the form of Official specifications say that everything behind that “+” must be ignored, but it can be used to automatically sort incoming mail into folders. I do this, by the way, so I describe here, how.

We need rules for those plus signs:

\"(.+)\+(.*)\"  translate "echo ‘{/bin/upas/aliasmail ’\1’}^’+\2’"

# The other translate rules are default

For delivering local mails, I added extra rules:

local!(.+)\+(.+)  |  "/bin/test -d /mail/box/\1/\2 \&\& /bin/upas/mbappend /mail/box/\1/\2 || /bin/upas/mbappend /mail/box/\1/mbox"

local!"(.+)+(.+)  |  "/bin/test -d /mail/box/\1/\2 \&\& /bin/upas/mbappend /mail/box/\1/\2 || /bin/upas/mbappend /mail/box/\1/mbox"

# leave the other rules untouched.

With this settings, mails to user+tag will be checked. If a mailbox folder for tag exists, mail is sent to this folder. Otherwise it is sent to the user’s default inbox. Note: I tested, but this does not work with aliased mail. If my aliasmail changes userA to userB, mails to userA+tag will be rejected! If you know how I can make this work, feel free to send me a mail.


This file is pretty easy. Just add your alias mail addresses:

postmaster  sirjofri

webmaster   sirjofri

abuse       sirjofri








fd=‘{/bin/upas/aliasmail -f $sender}


case *.*


case *


exec /bin/upas/smtp -h $fd $addr $sender $*


I don’t use port 587. I use 25 for this. Mail servers relay mails to this port by default, so it makes sense.



user=‘{cat /dev/user}

exec /bin/upas/smtpd -f -E -r -c /sys/lib/tls/cert -n $3

Don’t forget to create your TLS certificate!

IMAP4 over TLS

I did this exactly like the FQA. See there.


At this point I stopped. I did not configure ratfs and have no spam handling right now. It doesn’t really matter for me, because nobody knows me and I don’t use that mail address to register anywhere.