0

I'm trying to setup Exim with Amazon's SES. I've defined a router that catches all emails and sends them through SES. I don't want to filter anything for outboud. Everything goes through SES. My router config is the following:

begin routers

aws_ses:
  debug_print = "R: aws_ses for $local_part@$domain"
  driver = accept
  require_files = AWS_SES_SEND_EMAIL : AWS_CREDENTIALS_FILE
  transport = aws_ses_pipe
  no_more

It's working great except for one problem. Whenever I get any inbound email, Exim also tries sending them through SES. That's the problem. Local emails should be caught by Exim. I tried adding this just before my aws_ses router but it's not working. Exim still uses the aws_ses router for inbound emails to mydomain.com

localusers:
  driver = accept
  domains = mylocaldomain.com
  transport = virtual_userdelivery

So, how do I make Exim send all outbound emails through aws_ses router but at the same time, tell it to catch all inbound mails to mydomain.com so that it can be delivered to the user's mailboxes?

Thanks.

p.s. You can see the complete configuration on the tutorial I've put together. The relevant configs are pasted in this question though.

recluze
  • 355
  • 8
  • 18

1 Answers1

2

Routers are tried in order. You should just have been able to find a Router named "dnslookup" or "smarthost" or somesuch, and put your new router there in its place. Completely replacing the list of Routers is not advisable unless you have a lot of Exim experience (and the same goes for the RCPT ACL).

You should have a domainlist called local_domains, which is a list of domains to be handled on this host itself. Then, your aws_ses Router would include a line:

domains = !+local_domains

With that pre-condition in place, mails sent to a domain in the local_domains domainlist will not be handled by the aws_ses Router.

Next: you talk about mydomain.com in the text but then use mylocaldomain.com in your obfuscated example. An error like that would certainly explain what you're seeing. :)

Then: use something like:

$ exim -d -bt fred@mydomain.com

to get some copious debugging output about the decisions Exim is making in deciding how to handle that address.

Phil P
  • 3,040
  • 1
  • 15
  • 19
  • Hehe, thanks for pointing out the 'local' mistake. That crept in during the obfuscation. Didn't want to look like I was promoting a client's website or anything. Your solution works though. – recluze Aug 29 '11 at 04:02