--- mouss <mo...@ml.netoyen.net> schrieb am So, 29.3.2009: > >>> Hi, > >>> > >>> is there a way to rewrite a sender address in > >> dependence of > >>> the recipient? > >>> > >>> Example: > >>> sender + recipient = new sender address > >>> > ---------------------------------------------- > >>> j...@example.net > >> + j...@example.net > >> = robotforj...@example.net > >>> j...@example.net > >> + <anything else> = j...@example.net > >> (no change) > >> The less convoluted way I see would be to write a > content > >> filter to do > >> that. > >> > >> what "real" problem are you trying to solve? > >> > > The problem: > > - I have a webapp for an affiliate bussiness. The app > sends emails to the registered users in dependence off a > workflow-state. > > - the sender-email-address is an email-address of the > affiliated business (marketing decision) > > - in some cases the affiliated business whants also to > receive a CC of the message. But its email-server will not > accept an email (sender-address) of its domain coming from > outside of their network (SPAM-prevention). > > => Thats because I _must_ send the email in my > address, but for marketing reasons all other emails must be > send like they are send now (in their name) > > > > The actual solution is, that I send all emails for j...@example.net > to a third email-server which has a sender_canonical-rewrite > rule. This emailserver sends the email than forward with the > changed sender-email-address to the MX of j...@example.net. > This runs so actually successful for years.. But I'm > confident that there must be also a solution to solve the > problem using only one email-server. > > > > Is the problem understandable? > > > > try this: > > define a custom smtp transport that has its own > smtp_generic_maps: > > == master.cf > customersmtp .... smtp > -o smtp_generic_maps=pcre:/etc/postfix/customer_generic.pcre > > then use transport_maps to pass mail to your customers via > this transport. > I tested it with: == transport example.net smtp:[127.0.0.1]:26
== sender_canonical_X r...@example.net ad...@example.net == master.cf 127.0.0.1:26 inet n - y - - smtpd -o smtp_generic_maps=hash:/etc/postfix/sender_canonical_X Result is an endless loop until I get "554 Error: too many hops", btw. the sender-address wasn't rewriten After this I've changed the master.cf to: cleanupX unix n - n - 0 cleanup -o sender_canonical_maps=hash:/etc/postfix/sender_canonical_X -o transport_maps= 127.0.0.1:26 inet n - y - - smtpd -o cleanup_service_name=cleanupX -o transport_maps= Now the sender-adress is rewritten, but the email is stil send in a loop.. I guess that the "transport_maps" option doesn't make any difference because it is part of the qmgr. This would be an explantion for the loop, because after the rewrite the email is saved in the incoming folder. Which is later processed using the values of the transport_maps configured in main.cf. I've already tried to configure an own qmgr by setting an new queue_directory. The problem is, that the socket files are still created in the directory of the default qmgr, but on runntime searched in the new queue driectory (file not found errors in maillog). Any suggestions how I could solve the loop or force that the socketfiles are written in the new queue directory?