Autor: rblue Fecha: A: exim-users Asunto: Re: [exim] Decide what router to use according to the from field
On 7/17/2014 5:15 AM, Lena@??? wrote: >> From: Red Blue
>> What I am trying to accomplish is to use the send_via_ses router only if the envelope from field belongs to a local?domain.
>>
>> For some reason, the router is being ignored even when the from field belongs to a local domain.
>>
>> I have tried to use that acl condition to acl_smtp_rcpt and acl_smtp_data as well but I got the same behavior.
>>
>> Any ideas on what's wrong?
>>
>> router:
>>
>> send_via_ses:
>> driver = manualroute
>> domains = ! +local_domains
> The exclamation sign means "not". This is the default setup recommended by Amazon SES. I just added the
condition line below. When I remove the router's condition line below,
the router is being properly used for all the outgoing mails. >> transport = ses_smtp
>> route_list = * email-smtp.us-west-2.amazonaws.com;
>> condition = ${if eq{$acl_m_use_ses}{1} {yes}{no}}
>>
>>
>> ACL:
>>
>> acl_smtp_mail:
>> ??? warn
>> ?????? condition = ${if or{\
>> ??????? {match_domain{${domain:$h_From:}}{+local_domains}}\
>> ??????? {match_domain{$sender_address_domain}{+local_domains}}\
>> ??????? }{yes}{no}}
>> ?????? set acl_m_use_ses=1
> $h_* variables are available only after header and body are transmitted,
> i.e. in acl_smtp_data. When acl_smtp_mail is exectuted, header and body
> weren't transmitted yet.
> Routers are executed for the first time in the verify mode
> when acl_smtp_rcpt says "verify=recipient",
> also before transmission of header and body.
> As I stated above, I have tried the same ACL on acl_smtp_data with the
same behavior, but thanks for this clarification, I'll now move this acl
to acl_smtp_data.
How can I debug this further? I tried to use exim -bh and I copied and
pasted a sample email message to the console. It looks like that acl
condition is always failing regardless of the from address. I added an
add_header line to the router that was being used to be sure
${domain:$h_From:} was returning the expected result, and it is.