I'm creating a bounce email system where addressees can reply to messages on my site.
However when the email are sent to the user containing the previous message, the Reply-To
field contains an address like this [email protected]
(which contains the ID at the end).
If the user replies, the reply message will be sent back to [email protected]
which of course, doesn't have its own mailbox, except the [email protected]
.
How would I redirect all incoming messages coming from a specific wildcard notification-message-*@mysite.com
to [email protected]
? I did some research, but no solid part worked, including the luser_relay = [email protected]
and putting notification-message-*
in the postfix aliases table, the notification@
has a Maildir, so the mail would go into it.
A concept diagram:
I am using Ubuntu 11.04.
As have said mschuett, you can use regexp
First check that postfix supports regexp:
Create the file /etc/postfix/aliases-regexp and add to it your regexp
Run postmap and check whether it works:
If everything is OK, add this file to your alias database
Example:
If you are using virtual domains, add this file to your virtual_alias_maps
Example:
Do not forget to restart postfix.
Good luck!
Alias maps (virtual, local, ...) will work in combination with the regexp_table format. But if you have compiled in PCRE, then you can also use the pcre_table format.
Otherwise you should search for "Postfix catch-all" which is a bit more greedy.
I'd be inclined to solve this using
recipient_delimiter
.If you don't mind using slightly different
Reply-To
addresses, you can set:in your config, and then mail to e.g.
[email protected]
(note the+
) will be delivered to thenotification
user (assuming there are no more-specific rules/users matchingnotification+message-988742
).You could try setting
recipient_delimiter = -
(so that you could use theReply-To
headers as they are in the question) but I'm not sure how that would work with multiple instances of the delimiter on the left-hand side, and I don't have a Postfix to hand to check.Create a rule using "with specific words in the sender's address." It will accept multiple words as "or" but I don't see how to do it with an "and." Perhaps this gets you far enough.