Re: [exim] Exim: Select smarthost on basis of receipient add…

Top Page

Reply to this message
Author: Dominic Benson
To: exim-users
Subject: Re: [exim] Exim: Select smarthost on basis of receipient address
On 16/02/12 10:56, Muhammad Irfan wrote:
> Benson,
> I am using CENTOS 5.
> The only reason i am relaying emails from china ( SMTP) to
> US host contains all user mailboxes including china& US users on (
> While if china users sends an email to external domains
> i want those emails to send through china SMTP because
> most of the china users sends emails within china to external domains
> through this they don't have to route to US host and than
> it delievers back in china. I am having huge no. of complains from china
> users when sending emails with attachments. Fortunately i have machine in
> china DC. I installed exim on it and configured as STMP server for china
> users.
> I foresee sending emails from china to china host will
> improve email sending. Further, i will authenticate all china users via
> STMP AUTH through /etc/exim/passwd file and will store china users info
> there to authenticate. While for email recieving china users still need to
> fetch emails from US At this point i am also looking to
> replicate china user mailboxes from US to china host through unix rsync
> command. Don't know it's suitable or not.

I think that would be tricky. Especially with deletes - because the
delete would happen on one server, and then probably be undone. And the
'new' state of messages would be constantly clobbered.
I would think that it would be considerably easier to split the
mailboxes between the two, as has already been suggested. Cyrus with
Murder is probably the easiest way to do it. It also has the advantage
that mailboxes can be moved and clients updated independently. And that
roaming users can always connect to the closest regardless of where
their mailbox really resides.

> For email client for china users i will declare in
> incoming mail server to fetch emails from US host and will
> set in outgoing mail server option to send email for
> china users.
> I declared send_to_gatewary router just above dnslookup as follows.
> Also, please check following routers those will work as anticipitation ?
> And help me on this this solution is appropriate for my situation or not.
> Thanks in advance.
> send_to_gateway:
>    driver = manualroute
>    domains =
>    transport = remote_smtp
>    ignore_target_hosts = :
>    route_list = *
>    host_find_failed = defer
>    no_more

> dnslookup:
>    driver = dnslookup
>    domains = ! +local_domains :
>    transport = remote_smtp
>    ignore_target_hosts = :
>    no_more


Well, if I read your previous posts correctly then domains should be - i.e. your users have addresses of the form
bob@???; not bob@???

The domains condition on the dnslookup router is wrong (I think) - see
for an explanation of how negative list items work
- As it is after a router which would handle (once
corrected), then it isn't necessary to exclude anyway, so
you could just drop the second part
- If you did need to exclude multiple host lists, I think you would have
to negate each one. Or possibly you can negate the entire condition
(!domains=...), it works in an ACL, but I don't know if it does in a
router definition.