Re: [exim] Return-path rewriting or removal at transport lev…

Top Page
Delete this message
Reply to this message
Author: Stefano Sabatini
Date:  
To: exim-users
Subject: Re: [exim] Return-path rewriting or removal at transport level
On date Sunday 2006-12-17 00:40:49 +0100, Stefano Sabatini mailed:
> On Saturday 2006-12-16 22:02:11 +0000, David Woodhouse wrote:
> > On Sat, 2006-12-16 at 19:43 +0100, stefano.sabatini-lala
> wrote:
> > > I'm trying to remove the Return-path from all the *outgoing*
> > > mails. The following snippet configures my smarthost
> transport:
> >
> > The Return-path: header is added only by the MTA which
> finally delivers
> > the mail into a user's mailbox -- and the value it
> contains is the SMTP
> > reverse-path; the address used in the 'MAIL FROM:<...>'
> command.
> >
> > It's not surprising that some recipients are rejecting
> your mail, if
> > you're sending it with bogus return addresses. Investigate
> > qualify_domain and rewrite rules and make sure your
> reverse-paths are
> > correct.
> >
>
> Thank you David for your reply.
>
> Now I see which is my problem.
>
> I would like to rewrite the header From and Envelope From
> value for all the outgoing emails, and left unchanged the
> emails sent locally to the system.
>
> I can't do this at transport time (I can't rewrite the From
> header value but not the Envelope from) and I cannot do this
> at router time (because the headers_rewrite options simply
> doesn't exist).
>
> Thus the only thing that makes sense is to change it at
> rewrite time, but only for the emails sent outside the system.
>
> I would like to apply this rule at rewrite time:
>
> # change the From header value (f) and the From envelope
> value (F)
> headers_rewrite = *@+local_domains \
> "${lookup{${local_part}}lsearch{/etc/email-addresses}
> {$value}fail}" fF
>
> but *only for the outgoing emails*, so I should check before
> the recipient address, and eventually apply the rewriting rule.
>
> Is it possible (and eventually how)?
>


I've finally worked out this solution. In the remote smarthost transport section:

# sustitute the return-path if it's an internal address
return_path = ${lookup{${local_part:$return_path}}lsearch{/etc/email-addresses}{$value}fail}

# replace the From (f), reply-to (r) and sender (s) value
# with an outside world meaningful value
headers_rewrite = *@+local_domains \
    "${lookup{${local_part}}lsearch{/etc/email-addresses}{$value}fail}" fsr


It's redundant but it works.
A slightly better solution maybe could be:

headers_rewrite = *@+local_domains ${return_path}

Just another question:
Why is not possible to do simply this at transport time:

headers_rewrite = *@+local_domains \
    "${lookup{${local_part}}lsearch{/etc/email-addresses}{$value}fail}" F


(exim complains saying it's impossible to rewrite the return path at
transport time)

while it is possible to achieve the same result simply conditionally
rewriting the return_path value?

Cheers
--
Stefano Sabatini
Linux user number 337176 (see http://li.count.org)