Saturday, January 29, 2011

How do I allow extension part of e-mail in postfix when doing virtual delivery

Currently I have a /etc/postfix/virtual file that has entries like:

user@foo.com foo@bar.com 

I want to be able to forward user+asdf@foo.com to foo+asd@bar.com

How do I do this?

EDIT: I did set

propagate_unmatched_extensions = canonical, virtual

and

recipient_delimeter = +

but still keep getting Recipient address rejected: User unknown in local recipient table;

EDIT II: I made the changes suggested in @Schot's updated answer with some progress;

Now I get Recipient address rejected: User unknown in virtual alias table; when sending to user+asdf@foo.com

Sending to user@foo.com worked both before and after them modifications

EDIT III:

Postfix is version 2.3.3 - I do not have separate mail.warn or mail.err logs - just the /var/log/maillog. Here is the full (anonymized) snippet:

EDIT IV: Updated to postfix 2.3.19 with no luck.

EDIT V: Doing postconf -n showed that recipient_delimiter was misspelled in the main.cf as well as above and the delimiter was not processed at all.

  • $number substitutions are not allowed in the virtual file as a security precaution. http://www.postfix.org/PCRE_README.html

    From topdog
  • Your current entries are OK, you should look at the propagate_unmatched_extensions configuration parameter. Check that it includes virtual.

    About you regex not working, see the man page for virtual(8):

    The virtual(8) delivery agent disallows regular expression substitution of $1 etc. in regular expression lookup tables, because that would open a security hole.

    Update

    I have tested your configuration and it works for me. Maybe one of the following is the problem:

    • Is the virtual domain ("foo.com") listed in mydestination? If it is, remove it.
    • Is the virtual domain listed in virtual_alias_domains? If not, add it.

    Side note: Does sending mail to user@foo.com (without a +delimiter) work?

    Kimvais : I made the changes, some progress: now I get `Recipient address rejected: User unknown in virtual alias table;` when sending to `user+asdf@foo.com` - `user@foo.com` worked both before and after them modifications
    schot : @Kimvais: I'm running out of ideas... What is your postfix version? Anything in `/var/log/mail.warn` or `/var/log/mail.err`?
    Kimvais : @schot - so am I. Updated the question nevertheless...
    schot : @Kimvais: Version 2.3.3 is pretty old, try upgrading to 2.3.19 or the latest 2.6 or 2.7 release.
    Kimvais : @schot: just upgraded to 2.3.19 - no help. Will try 2.7 next...
    Kimvais : SUCCESS! Finally noticed that there was a typo in my `main.cf` it is `recipient_delimiter` not recipient_delim__e__ter ...
    From schot
  • It's recipient_delimiter not recipient_delimEter

    From Kimvais

0 comments:

Post a Comment