Re: [exim] address rewriting of To: header

Top Page
Delete this message
Reply to this message
Author: Ian Eiloart
Date:  
To: Søren Dam, exim-users
Subject: Re: [exim] address rewriting of To: header


--On 6 April 2009 13:09:05 +0200 Søren Dam <post@???> wrote:

> Im a newbie to exim and i have this urgent problem
> We have som comstumers that insist to send mail to your symstem as bcc. We
> have a backend system that wil have to use the To: header to process the
> mail. They send to alle kinds of aderesses and we,ve set up a catch-all
> e-mail to handle that. I need to take the adress from the recieved header
> and rewrite:
>
> from:
> "..
>
> Return-path: sender@???
> Received: from [****] (helo=domain.com)
>     by localhost.localdomain
>     with esmtp (Exim 4.63)    (envelope-from <sender@???>)
>     id 1LqmYP-0006bg-E6    for reciever@???;
>     Mon, 06 Apr 2009 12:59:49 +0200
> Received: from [***] (unknown [***])
>     by sender.com (Postfix) with ESMTP id D795816A95C
>     *for <reciever@???>*; Mon,  6 Apr 2009 12:59:49 +0200 (CEST)
> Message-ID: <49D9E0A5.2030202@???>
> Date: Mon, 06 Apr 2009 12:59:49 +0200
> From: kasper <sender@???>
> User-Agent: Thunderbird 1.5.0.12 (X11/20090114)
> *To: undisclosed-recipients:;*
> Subject: (no subject)
> MIME-Version: 1.0
> Content-Type: text/plain; charset=ISO-8859-1
> Content-Transfer-Encoding: 7bit

>
>
> .."
> to
> "..
>
> Return-path: sender@???
> Received: from [****] (helo=domain.com)
>     by localhost.localdomain
>     with esmtp (Exim 4.63)    (envelope-from <sender@???>)
>     id 1LqmYP-0006bg-E6    for reciever@???;
>     Mon, 06 Apr 2009 12:59:49 +0200
> Received: from [***] (unknown [***])
>     by sender.com (Postfix) with ESMTP id D795816A95C
>     *for <reciever@???>*; Mon,  6 Apr 2009 12:59:49 +0200 (CEST)
> Message-ID: <49D9E0A5.2030202@???>
> Date: Mon, 06 Apr 2009 12:59:49 +0200
> From: kasper <sender@???>
> User-Agent: Thunderbird 1.5.0.12 (X11/20090114)
> *To: reciever@???*
> Subject: (no subject)
> MIME-Version: 1.0
> Content-Type: text/plain; charset=ISO-8859-1
> Content-Transfer-Encoding: 7bit

>
>
> .."
>
> I've tried to mess around with adress rewriting and got it to work, but i
> don't know how to strip the email form the recieved field.


Exim can acquire the recipient email address from $local_part and $domain.
So you'd need to use headers_remove and headers_add in your transport - and
make sure that you're only delivering one message at a time. However, you
may wish to take care to preserve the original content of the headers that
you're modifying - depending on what you're doing at the back end.

I presume that you mean "acquire the email from the received field" rather
than "strip" (= remove).

Strictly, $local_part and $domain aren't acquired from the received header,
rather the received header is built using those variables (I think).
>
> thanks in advance
>
> Søren




--
Ian Eiloart
IT Services, University of Sussex
01273-873148 x3148
For new support requests, see http://www.sussex.ac.uk/its/help/