🕰️
⬩
✍️ Evert Mouw
⬩
⏱️ 0 min
Sending to localhost aliases and outside addresses with default a domain name using Postfix on Debian; working config
How to send to both local users (like root
) from
cronjobs, and to outside addresses with a default domain added that
actually also passes SPF checks.
Related problems / information:
- Set up postmaster using Postfix
- Get postfix to forward root’s mail
- postfix /etc/mailname
- Postfix address masquerading

/etc/hosts
127.0.0.1 localhost mercurius mercurius.spacedomain.net
/etc/mailname
mercurius.spacedomain.net
/etc/aliases
postmaster: root
root: explorer@moonbase.org
/etc/postfix/main.cf
myorigin = mercurius.spacedomain.net
masquerade_domains = spacedomain.net
append_dot_mydomain = no
myhostname = mercurius.spacedomain.net
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, localhost, localhost.localdomain
TEST
echo test | mail -s test root
Deze blogpost werd in december 2022 overgezet van WordPress naar een methode gebaseerd op Markdown; het is mogelijk dat hierbij fouten of wijzigingen zijn ontstaan t.o.v. de originele blogpost.