Re: [exim] Multiple GMail Smart Hosts (smarthosts)

Góra strony
Delete this message
Reply to this message
Autor: Phil Pennock
Data:  
Dla: Samuurai
CC: exim-users
Temat: Re: [exim] Multiple GMail Smart Hosts (smarthosts)
On 2009-10-19 at 07:55 -0700, Samuurai wrote:
>
> Hi Everyone,
>
> I'm a newbie when it comes to Exim, so please go easy.
>
> I've been reading a few tutorials on how to set up multiple gmail
> smarthosts, but can't figure it out.
>
> I have two sites hosted on my server and they both need to send email. I've
> set up google apps for domains and set up a donotreply@??? email
> account.
>
> I've got it currently set up perfectly where all email can come out of
> domainX, but I want to make it so it reads the "From:" field then uses a
> different set of authentication credentials based on that. - The server will
> be smtp.gmail.com for both.
>
> Has anyone seen any forum posts, blogs or tutorials about this, as I really
> don't know where to start with the config.


I wrote this, which uses recipient domain instead of From: header:
http://www.mail-archive.com/exim-users@exim.org/msg29852.html

It's not much work to change it to use From: instead; where my example
uses $domain; beware that From: header can contain multiple addresses,
so you might want to define a macro, something like:

FIRST_FROM=${reduce{${addresses:$h_from:}}{}{${if eq{$value}{}{$item}{$value}}}}

Then you can use ${domain:FIRST_FROM} instead of $domain.

Or you can use the SMTP envelope sender or whatever,
$sender_address_domain. Which is somewhat simpler.

Hrm, in a follow-up I also provided a simpler way to get the first
address, so:

FIRST_FROM=${sg{${addresses:$h_From:}}{:.*}{}}

I *think* that someone then posted a little later with their working
simplification based on From: headers. I'm not going to look for it
tonight though -- this should be enough to point you in the right
direction.

-Phil