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 catchall@domain2.com
mail1@domain1.com person1@domain2.com
domain3.com anything
mail2@domain3.com person2@domain4.com
Example outcomes:
- anything@domain1.com -> catchall@domain2.com
- mail1@domain1.com -> person1@domain2.com
- something@domain3.com -> bounce
- mail2@domain3.com -> person2@domain4.com
- anything@domain-xyz.com -> 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.