I've got a situation which doesn't seem all that unusual, but I can't
figure out how to properly set it up with OpenSMTPd on OpenBSD
7.0-release. I need to receive email from anywhere to my local users
(most, but not all, of whom should not have accounts on the mailserver)
and relay email from any local system to anywhere. Incoming mail for my
local users should be saved to /var/virtual/<user>/Maildir (all owned
by one special user) for pickup via pop3 or imap.
I hope I understooded you correctly.
table aliases file:/etc/mail/aliases
table mail2user {
f...@example.com = user1,
b...@example.com = user2,
@example.com = user3 }
action "receivedLocally" maildir "/var/virtual/%{dest.user}/Maildir"
user onespecialuser alias <aliases>
action "receivedRemotely" maildir "/var/virtual/%{dest.user}/Maildir"
user onespecialuser virtual <mail2user>
action "relay2Internet" relay
match for local action "receivedLocally"
match auth from any for domain example.com action "receivedRemotely"
match auth from any for any action "relay2Internet"
(Untested because I personally only ever use lmtp.)
'action' interact is murky at best. In particular, the interactions
among 'alias', 'userbase', and 'virtual' are not obvious to me, as is
exactly what 'userbase' does (though the manpage for table(5) helps.).
alias
xyz: user1
Mails for xyz will be delivered to user1.
userbase <foobar>
Instead of looking into /etc/passwd to get informations about the user
(for example what the /home/dir is) the table foobar is used.
virtual
xyz user1
z...@example.com user2
@example.com allexample
@ all
For a description of the difference between alias and virtual see
Aliasing tables in man 5 table. (Not sure if one could say alias exists
more because of tradition. It makes sure that on an unconfigured system
root gets system messages. (Because of file:/etc/mail/aliases))
Also, 'postmaster', and several other names listed in RFC 2142, are
supposed to always be processed case-insensitively; I don't see any
mention of what, if anything, is done about this. Even if nothing is
done an explicit statement to that effect would be useful.
All lookups are case-insensitive.