Re: [exim] Hints needed to run forwarded messages through a …

Etusivu
Poista viesti
Vastaa
Lähettäjä: David S. Madole
Päiväys:  
Vastaanottaja: 'Erik Schorr', 'exim-users@exim.org'
Aihe: Re: [exim] Hints needed to run forwarded messages through a pipe
> From Erik Schorr on Wednesday, June 27, 2007 6:39 AM
> David S. Madole wrote:
> >> From Erik Schorr on Tuesday, June 26, 2007 10:51 PM
> >>
> >>    command = "forward_prog -f '$header_from' -r 
> >> '${local_part}@${domain}' -t '${lookup mysql {SELECT alias FROM 
> >> email_virtuser WHERE user='$local_part' AND domain='$domain' AND 
> >> is_alias='Y' AND active='Y'}{$value}}'"

> >
> > I don't really know the direct answer to your question, but
> > what does forward_prog actually do? You might be able to do
> > the same thing within Exim without calling an external
> > program. Exim can add, remove, and change headers. If it's
> > just rewriting addresses, it can do that too, very easily.
>
> For example, for any messages coming into a user's account
> who's forwarding the message to Yahoo, AND where the sending
> address is a Yahoo address, we want to copy the original
> Envelope FROM address into the new "Reply-to", "Bounces-to",
> and From headers, and use the forwarding (local) account's
> email address as the new Envelope FROM address, while leaving
> the From header in the email intact. This is just one case,
> and something that I initially want to do in an external
> program. It will certainly eventually made into a router or
> transport that includes sql lookups to accomplish the same
> thing, but for development and testing of forwarding
> deliverability under the different circumstances, I want to
> do this in an external program.


Sorry I can't help with the original question, I've never had a need to use a pipe.

But I would still suggest that you look at doing this directly in Exim from the start. Rewriting rules alone can do 90% of what you are looking for, and the headers_rewrite transport option might be useful, as well as headers_add and headers_remove.

I do an extensive amount of message processing based on database content, and one thing that works well for me is to have a dummy router early in the chain that does the database lookup and populates $address_data with everything that will be needed later, with the individual fields accessible through ${extract ...}. It can save a lot of ad-hoc database lookups scattered all over the configuration.

Mine looks like this:

lookup:

driver = redirect
data = ""
address_data = ${lookup mysql { select userid, domain, mailto, .... } {$value} }

Then when I need the data later on in delivery, I just ${extract{mailto}{$address_data}} for example.

David