Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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 list domain1.com and domain3.com under virtual_alias_domains (and not under mydestination). Also make sure that you've run postmap on /etc/postfix/virtual.

virtual_alias_domains = domain1.com, domain3.com
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.