Re: [exim] How to rewrite From: header of offsite forwards o…

Top Page
Delete this message
Reply to this message
Author: Pete Schaefers
Date:  
To: Exim-users
Subject: Re: [exim] How to rewrite From: header of offsite forwards only to prevent Amazon SES 554 error
On 2018-03-23 10:10, Graeme Fowler wrote:
> On 22 Mar 2018, at 22:06, Pete Schaefers via Exim-users

<exim-users@???> wrote:
> > send_via_ses:
> > driver = manualroute
> > domains = ! +local_domains
> > transport = ses_smtp
> > route_list = * email-smtp.us-west-2.amazonaws.com;
> >
> > It sends all non-local mail to SES. I need to have it not send

forwards and let them be handled locally.
>
> How exactly are the 'forwarded' emails generated? You've mentioned an

alias lookup already but it isn't entirely clear how these are being
generated.
>
> The router above will punt anything for a recipient which is *not* in

the local_domains domain list to your Amazon smarthost.
>
> If you want to catch messages which have some other condition and

deal with them locally, you'll need another router with a condition that
can identify them (and a corresponding condition on this router to not
handle them).
>
> Graeme


Sorry to not be clear. I'm referring to aliases/forwards, not forwarded
email (which is still FROM a local domain). I just want to *not* send
mail to SES that it won't process (as well as not sending local
messages, which is already being accomplished by "domains = !
+local_domains" as you said). Anything not sent to SES then defaults to
local handling. SES rejects sending messages that are generated when an
outside address sends to a local account that is also aliased, or is
only an alias, because the FROM address is the original sender's outside
address. (Forwarding is setup on a cPanel server by cPanel creating a
list of aliases for each domain in /etc/valiases/example.com)

Am I correct that "domains =" only refers to the recipient (TO/CC/BCC)
domain, and that "sender =" only refers to the original sender (FROM)
domain? If so, then would the below prevent the forwards from being sent
through SES?

send_via_ses:
driver = manualroute
domains = ! +local_domains
senders = +local_domains
transport = ses_smtp
route_list = * email-smtp.us-west-2.amazonaws.com;

If I understand correctly this would dictate that only messages the are
*not* TO a local domain *and are* FROM a local domain go to SES. This
would seem to do what I want.

Or am I missing some additional case (other than a forward/alias) where
mail is sent TO a remote domain, and is not FROM a local domain?