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 just want to catch all email sent to * @domain.com AND * @ * .domain.com to a unique email system@domain.Com

@runlevel6 Any idea to implement regexp in virtual like

cat /etc/postfix/virtual 
@example.com system@example.com 
/[@*].example.com$/ system@example.com

I found it:

in main.cf

virtual_alias_maps = regexp:/var/spool/postfix/plesk/virtual-sub

in virtual-sub

/[@.]example\.tld$/ sure@example.tld

thx runlevel6

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Postfix supports the use of a catchall account using the luser_relay configuration option.

See the postfix page for luser_relay for more information.

When the local(8) delivery agent finds that a message recipient does not exist, the message is normally returned to the sender ("user unknown"). Sometimes it is desirable to forward mail for non-existing recipients to another machine. For this purpose you can specify an alternative destination with the luser_relay configuration parameter.

If it is not a catchall for all domains on the server you can instead user Virtual Aliases. See the postfix page for virtual aliases for more information. Short description and code excerpt from that page are as follows:

With virtual alias domains, each hosted address is aliased to a local UNIX system account or to a remote address. The example below shows how to use this mechanism for the example.com domain.

/etc/postfix/main.cf:

virtual_alias_domains = example.com ...other hosted domains...
virtual_alias_maps = hash:/etc/postfix/virtual

/etc/postfix/virtual:

postmaster@example.com postmaster
info@example.com       joe
sales@example.com      jane
# Uncomment entry below to implement a catch-all address
@example.com           jim
...virtual aliases for more domains...

After making those changes, run postmap /etc/postfix/virtual and postfix reload.

EDIT: I think the regexp that you are looking for is /[@.]example\.com$/ system

You might need to make additional changes in main.cf to support this. See this post for more information.

share|improve this answer
    
thx will try it now. –  chahedous Jul 17 '10 at 13:20
    
Any idea to implement regexp in virtual like cat /etc/postfix/virtual @example.com system@example.com /[@*].example.com$/ system@example.com –  chahedous Jul 17 '10 at 13:58
    
post updated with regexp and a link to a post on LinuxQuestions.org that has more information. –  runlevelsix Jul 17 '10 at 15:45

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.