I'm setting up a forwarding only email server. I want to apply some static forwarding rules to all incoming emails and bounce all other incoming emails (and not store them locally).
/etc/postfix/main.cf
myhostname = sputnik.*domain*.com
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
myorigin = /etc/mailname
mydestination = sputnik.*domain*.com, localhost.*domain*.com, , localhost
relayhost =
mynetworks = 127.0.0.0/8 10.0.0.0/24 [::1]/128 [fe80::%eth0]/64
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
virtual_alias_maps = hash:/etc/postfix/virtual
/etc/postfix/virtual
domain1.com anything
@domain1.com [email protected]
[email protected] [email protected]
domain3.com anything
[email protected] [email protected]
Example outcomes:
- [email protected] -> [email protected]
- [email protected] -> [email protected]
- [email protected] -> bounce
- [email protected] -> [email protected]
- [email protected] -> bounce
Currently instead of bouncing the emails they are getting stored at /var/mail/*username*
and the sender isn't alerted that the email didn't go through.
The Postfix documentation has an example of this under mail forwarding domains. I'm not sure what's going on with your
mydestination
line (Postfix doesn't seem to support wildcards here), but you need to listdomain1.com
anddomain3.com
undervirtual_alias_domains
(and not undermydestination
). Also make sure that you've runpostmap
on/etc/postfix/virtual
.