Tony Demark a écrit : > > On Feb 8, 2009, at 2:31 PM, Wietse Venema wrote: > >> Tony Demark: >>> I would like to move some of my virtual domains to have their email >>> hosted via a "Google for Domains" account. While there are only a >>> handful of accounts, most of the accounts have many aliases and have >>> used '-' as a recipient delimiter for years. As such, the actual >>> number of addresses is probably in the thousands. Since Google uses >>> '+' as the recipient delimiter, there is no easy way to just switch >>> the domains over. I would like to use my Postfix server to filter / >>> rewrite incoming addresses and then relay them on to Google, with my >>> server being the MX server for the domain and using a smtp "transport" >>> entry to direct the messages to the right place. >> >> http://www.postfix.org/virtual.5.html >> http://www.postfix.org/pcre_table.5.html > > I tried PCREs at one point, and got close, but I kept hitting a wall > that original left hand side of the address would get relayed to the new > server, as opposed to the one that was specified in the virtual table. > For example: > > virtural_regex: > /^(.*?)-(.*)@example.com$/ $...@example.com > > If the original server gets an email addressed to > 'me-foo...@example.com', I need the email to be relayed to > 'm...@example.com', not 'me-foo...@example.com'. >
you can test lookups using 'postmap -q'. /^(me)-...@example\.com$/ m...@example.com do this for all valid addresses. If you use a wildcard like /^([^-]+)-...@example\.com$/ $...@example.com you will break recipient validation and your postfix will accept mail for any doesnotexist-ran...@example.com.