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

Top Page
Delete this message
Reply to this message
Author: Muhammad Irfan
Date:  
To: Exim-users
Subject: Re: [exim] Exim: Select smarthost on basis of receipient address
>> . In this case, the best method would be a simple lookup on a local
database (perhaps a replicated LDAP server) to decide which mailstore to
deliver to. That would allow you to have identical configurations on each
smtp server.

I don't have any knowledge of Cyrus, so not using it. Can you please
mention any link, tutorial, howto to achieve objective i am looking for ?
I thought something like following i need to do on both exim instances
correct me if i am wrong.

I will create china users mailboxes on china exim instance and for US users
i create mailboxes on US exim instance. But still not sure how to keep same
domain name for china & US users because china pointing to
mail1.example.comand US exim pointing to
mail.example.com. So china users will use mail1.example.com in email client
to send / receive while US users will use mail.example.com in email client
to send / receive email.
Please let me know how to keep same domain name @example.com

The scenario i am looking will work as follows:
First system look for localuser, let suppose someone from china sends an
email to his colleague in china abc@??? sends to
xyz@??? it first check
xyz@??? exists locally and will deliever it within china to xyz
mailbox by localdelievery transport.

begin router

localuser:
driver = accept
check_local_user
# local_part_suffix = +* : -*
# local_part_suffix_optional
transport = local_delivery
cannot_route_message = Unknown user

And if xyz@??? exists in US exim server than it executes router
send_to_gateway and checks email sender address is @example.com and email
is for @example.com than email will relay to US exim server where US exim
server will handle that email locally.

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
Finally if anyone from china from email abc@??? sends an email to
external domain like hotmail,yahoo it will send via dnslookup from china.

dnslookup:
driver = dnslookup
domains = ! +local_domains
transport = remote_smtp
ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8
no_more
begin transports
remote_smtp:
driver = smtp

local_delivery:
driver = appendfile
file = /var/mail/$local_part
delivery_date_add
envelope_to_add
return_path_add
group = mail
mode = 0660
Please let me know if you found any errors, flaws in it.I am looking
forward for your suggestions.

Thank you.

On Mon, Feb 20, 2012 at 4:12 PM, Ian Eiloart <iane@???> wrote:

> On 19 Feb 2012, at 15:08, Muhammad Irfan wrote:
> >
> >
> > Same scenario will work from US exim server. Hoping i explained my
> > requirements well enough.
> >
>
> Yes, the requirements are clear.
>
> > Can someone please point to achieve this through examples,docs etc.
>
> That depends on how you do your final delivery to the mail store. If
> you're using a mailstore with an SMTP or LMTP interface (e.g. Cyrus IMAP)
> then you can just deliver directly to the mail store. You would not need an
> SMTP relay to do the delivery. In this case, the best method would be a
> simple lookup on a local database (perhaps a replicated LDAP server) to
> decide which mailstore to deliver to. That would allow you to have
> identical configurations on each smtp server.
>
> --
> Ian Eiloart
> Postmaster, University of Sussex
> +44 (0) 1273 87-3148
>
>