For development purposes I wanted an smtp server, that simply places all mails into a local mailbox. To achieve this, I tried to setup a minimal postfix system.
# master.cf
smtp inet n - n - - smtpd
cleanup unix n - n - 0 cleanup
qmgr unix n - n 300 1 qmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
scache unix - - n - 1 scache
proxymap unix - - - - 1 proxymap
postlog unix-dgram n - n - 1 postlogd
# main.cf
compatibility_level = 3.7
queue_directory = /var/spool/postfix
command_directory = /usr/bin
daemon_directory = /usr/lib/postfix/bin
data_directory = /var/lib/postfix
mail_owner = postfix
inet_protocols = ipv4
unknown_local_recipient_reject_code = 550
mydestination = localhost
alias_maps = regexp:{{/.*/ mytargetuser@localhost}}
alias_database = $alias_maps
Talking to smtpd is no problem. I get successful responses through the entire conversation, however in the end, postfix tries to use smtp
to deliver the mail, which is not enabled:
postfix/smtpd: connect from myhost.mydomain[127.0.0.1]
postfix/smtpd: 8D548E40850: client=myhost.mydomain[127.0.0.1]
postfix/cleanup: 8D548E40850: message-id=<20220506145639.8D548E40850@myhost>
postfix/qmgr: 8D548E40850: from=<[email protected]>, size=408, nrcpt=1 (queue active)
postfix/qmgr: warning: connect to transport private/smtp: Connection refused
postfix/error: 8D548E40850: to=<[email protected]>, relay=none, delay=30, delays=30/0/0/0.01, dsn=4.3.0, status=deferred (mail transport unavailable)
Any clue, why alias_maps
is not working as I indended to use it here?