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

Top Page

Reply to this message
Author: Muhammad Irfan
Date:  
To: Exim-users
Subject: Re: [exim] Exim: Select smarthost on basis of receipient address
Hello,

Currently i have only one primary mail server on exim instance hosts all
users mailboxes with IMAP/POP3 and for sending SMTP. All users authenticate
via IMAP/POP3.


Now i want to separate exim instances geographically to improve email
send/recieve mechanism without changing domain name. I want to retain @
example.com either side. And want each user mailbox will be host at there
local DC exim server.


Simply i want to have two mail servers one in USA DC and another in China
DC. I will maintain china users lists in file in china exim server
mail1.example.com and US users lists in file in US exim server
mail.example.com


Scenario is when someone from china office sends an email to
chinauser@??? it will connect to mail1.example.com in china and
through router it checks chinauser exists in file if it exists than email
will deliever locally and if email send to usa-user@??? it again
connects to mail1.example.com and checks in file if user exists certainly
not because email is for US user it skips first and will go to next router
and relay email to US exim server which will deliever email.

Secondly, if user from china sends an email to external domain first two
routers skip and email directly delievers from this china exim server
through dnslookup router.

Same scenario will work from US exim server. Hoping i explained my
requirements well enough.

Can someone please point to achieve this through examples,docs etc.


Looking forward for your help.


Thank you.






On Fri, Feb 17, 2012 at 5:23 PM, Muhammad Irfan <mirfan1981@???>wrote:

> Benson,
>
> >> You can do it in Exim, though, but it would be more manual: if you give
> both Exim instances a list of local parts in one of the locations (probably
> China, for you) and deliver to that location when the local part is in that
> (probably a lookup against a file), then go to the forward/accept router to
> send mail to the other location. The domain being the same just means that
> you have to do a bit more work to find where to deliver mail.
>
> You mean i create an flat file which holds all china user names and made
> appropriate changes in exim.conf on US primary exim server which will looks
> for $local_part in file from router configuration and if found relay that
> email to china and will land there in china user mailbox and if $local_part
> not found in file than it will go to next router and deliever it locally
> means if user not found in file list than that email is for US user.
> *I thought it is nice which i can give a try.If is there any
> documentation, howto or any article available to do this than please point.
> *
> **
> Question i had in mind through this i need to create china user mailboxes
> on china only on mail1.example.com and US user mailboxes on US only
> mail.example.com right ? And through this domain will be the same for all
> users including US / China i.e. @example.com ?
>
> If that was successfull i think i need to maintain china users file list
> in china exim server also and will same way so when anyone sends an email
> from china it will look into file that this email is for local china user
> if yes, than deliever locally and if it is for US user than relay it to
> mail.example.com in US.
> i will add one more condition in send_to_gateway router in china that
> whenever china user sends an email locally to it colleague (china user) it
> will not relay email directly to mail.example.com in US instead first
> check if user mailbox exists locally than deliver otherwise that email is
> for US user usa-user@??? now relay it to US via route_list or
> route_data.
> Is that correct ?
>
> *
> send_to_gateway:
> driver = manualroute
> condition = ${if eq {${lc:$sender_address_domain}} {example.com} {true} fail }
> domains = example.com
>
> transport = remote_smtp
> ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
> route_list = * example.com
> host_find_failed = defer
> *
>
> I appreciate your help in this regard.
>
>
> On Fri, Feb 17, 2012 at 5:04 AM, Dominic Benson <dominic@???>wrote:
>
>>
>> On 16 Feb 2012, at 12:59, Muhammad Irfan wrote:
>>
>> > Yes, addresses of the form bob@???
>> > corrected as follows:
>> >
>> > send_to_gateway:
>> > driver = manualroute
>> > domains = example.com
>> > transport = remote_smtp
>> > ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
>> > route_list = * 69.16.197.150
>> > host_find_failed = defer
>> >
>> > dnslookup:
>> > driver = dnslookup
>> > domains = ! +local_domains
>> > transport = remote_smtp
>> > ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
>> > no_more
>> >
>> > Also tested will exim -bt command and looks OK to me. Let me know if you
>> > still found any issues in it.
>> >
>> > $ exim -bt bob@???
>> > router = send_to_gateway, transport = remote_smtp
>> >
>> > $ exim -bt bob@???
>> > router = dnslookup, transport = remote_smtp
>> >
>>
>> That looks fine to me.
>>
>>
>> [snip]
>> >
>> > Is there any way in exim to replicate mailboxes ? so i can replicate
>> china
>> > user mailboxes from US DC primary MTA to secondry SMTP.
>> > Is there any possibliity without changing domain name for any user i can
>> > improve email receive mechanism.
>> > Any suggestion.
>> > And sorry for long post.
>> >
>> > Waiting for your reply.
>> >
>> > Thanks,
>> >
>>
>>
>> I don't think that replicating mailboxes is the way to go. As I said
>> before, if you're modifying it from both ends you're just making problems.
>>
>> You *can* have mailboxes in both places on the same domain. There are a
>> few ways to do it; as I said before, I think that Cyrus is your best bet
>> because it provides the ability to split mailboxes across multiple hosts,
>> and connect via any. You don't have to maintain it all by hand that way.
>>
>> You can do it in Exim, though, but it would be more manual: if you give
>> both Exim instances a list of local parts in one of the locations (probably
>> China, for you) and deliver to that location when the local part is in that
>> (probably a lookup against a file), then go to the forward/accept router to
>> send mail to the other location. The domain being the same just means that
>> you have to do a bit more work to find where to deliver mail.
>>
>>
>> --
>> ## List details at https://lists.exim.org/mailman/listinfo/exim-users
>> ## Exim details at http://www.exim.org/
>> ## Please use the Wiki with this list - http://wiki.exim.org/
>>
>
>