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

I would like to setup postfix to catch all emails from both: domain.tld & [randomsubdomain].domain.tld.

/((\w[\w\-]*)\.)+domain\.tld/ OK 

This rule works very good, but unfortunately it's catching only mails for [randomsubdomain].domain.tld. Any mail to domain.tld is blocked with below error:

NOQUEUE: reject: RCPT from mail-xx[209.xx]: 554 5.7.1 <test@domain.tld>: Relay access denied;

/home/admin/postfix/virtual_domains:

/((\w[\w\-]*)\.)+domain\.tld/ OK

/etc/postfix/main.cf:

virtual_mailbox_domains = pcre:/home/admin/postfix/virtual_domains
virtual_alias_maps      = pcre:/home/admin/postfix/virtual_aliases

/home/admin/postfix/virtual_aliases:

/@((\w[\w\-]*)\.)+domain\.tld/ mailuser

Any ideas how can I solve it ?

share|improve this question

1 Answer 1

Sure. Just do this:

/home/admin/postfix/virtual_domains:

/((\w[\w\-]*)\.)+domain\.tld/ OK
/^domain\.tld/ OK

and /home/admin/postfix/virtual_aliases:

/@((\w[\w\-]*)\.)+domain\.tld/ mailuser
/@domain\.tld/ mailuser

Was an easy one, wasn't it? If you want it more complicated you could rework the second lines into the first one, but then it looks more ugly.

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.