On Monday 05 December 2011 06:11:27 Ignacio wrote:
> On Sun, Dec 4, 2011 at 9:15 PM, /dev/rob0 <r...@gmx.co.uk> wrote:
> > Your OP sounded as if the headers needed to change for some
> > reason. Since we now know that envelope senders and recipients
> > are what matters, it's time to move beyond.
> > 
> > Unfortunately elsewhere in the thread you indicated that your
> > example sender and recipients are not static. In this post I am
> > again answering what you said, not what you might have meant.
> 
> I have used header_checks to add a CC field containing original
> sender address. This way when there is a reply to e-mail, original
> sender will receive the reply also.

Again, that only changes the content of the mail; it does not add a 
recipient. But if you need that, fine.

> > > The application connects to a smtp server and sent an e-mail
> > > as: SENDER: user1@domain
> > > TO: user2@domain;user3@domain
> > > 
> > > From this smtp server we would like to relay e-mail to
> > > Corporate Exchange server.This server needs authentication to
> > > relay e-mail. Since user1 password changes every week, we
> > > would like to set a generic user whose password will not
> > > change. Therefore, sender must be changed to
> > > genericuser@domain.
> > 
> > For the rewriting:
> > http://www.postfix.org/ADDRESS_REWRITING_README.html#canonical
> > http://www.postfix.org/postconf.5.html#sender_canonical_maps
> > http://www.postfix.org/canonical.5.html

> I used generic config file to change original sender.

The reason why I recommended canonical(5) over generic(5) was the 
former's ability to restrict rewriting to only sender addresses. 
Knowing that you needed to send a copy to the original sender, I 
didn't think smtp_generic_maps would work. Won't that also rewrite 
that address in the RCPT TO command and your new Cc: header?

Disclaimer: I should say that I've never had to use either feature, 
therefore my understanding might be a bit off.

> > > Also it is needed that
> > > original sender (user1@domain) became a recipient of e-mail in
> > > Corporate Exchange server ( I thought this could be achieved by
> > > setting CC field in the e-mail, but it seems I was wrong).
> > 
> > http://www.postfix.org/postconf.5.html#sender_bcc_maps
> > containing:
> > genericuser@domain                      user1@domain

> I just did some quick tests in a test environment and it seems to
> work properly with different senders. BCC map is being applied
> before rewriting sender address so with a mapping like
> user1@domain user1@domain
> user2@domain user2@domain
> ...
> I got a BCC sent to original sender.

I'm pretty sure that with canonical maps, the rewriting takes place 
before the sender_bcc_maps. (But see disclaimer above.)

> Thank you very much for your help. It was very useful to get a
> working solution to solve my problem. Now I only have to set it up
> in production environment. Hope it will work as well as it did in
> tests! :)

If it does what you need, good deal! I'm glad it helped you, but 
honestly, a bit sorry that I/we indirectly helped support broken 
proprietary software. We do the work, they get the money, sigh.
-- 
    Offlist mail to this address is discarded unless
    "/dev/rob0" or "not-spam" is in Subject: header

Reply via email to