[Pkg-exim4-users] How to Connect to smtp.gmail.com with different login/password pairs

Ian Kelling iank at fsf.org
Tue Sep 13 17:35:02 BST 2022


Sébastien Hinderer <Sebastien.Hinderer at ens-lyon.org> writes:

> Dear all,
>
> Showt version: is it possible to use different login/password pairs in
> different (manual) routers that connect to smtp.gmail.com and,
> if yes, how, please?
>
> Explanation: I have several email addresses and for better account
> separation / isolation I would like to use the right smarthost for
> each account. I thus define one router per account and it works well,
> except in the following case.
>
> I have two GMail accounts: a personal one (personal at gmail.com) and one
> because the company I am working for has its emails hosted by GMail
> (professional at company.com). In the two cases the e-mails need to go through
> smtp.gmail.com (smarthost) but what needs to change is the login
> and password used to connect to it, so that if I send e-mails from my
> perso at gmail.com address I log to smtp.gmail.com with htis address as the
> login and the corresponding password, and, similarly, if I send e-mails
> with my professional at company.com address, the associated credentials
> (rather than the personal ones) are used to connect to smtp.gmail.com.
>
> With the passwd.client method only one login / password pair can be
> associated to each host, so it is not expressive enough.

I think you are right.

>
> I looked up Exim's documentation for a way to override the login in each
> router but couldn't find a way of doing that either.

So, something like:



I think you mainly want to define a new router that is higher priority
than the existing smarthost one  which goes to a new
transport which gets the password in a different way than passwd.client,
an example router:


gmailmarthost:
  debug_print = "R: smarthost for $local_part@$domain"
  driver = manualroute
  domains = ! +local_domains
  senders = my-gmail-address at gmail.com
  transport = my_smarthost_transport
  route_list = * mail.google.org::587 byname
  host_find_failed = ignore
  same_domain_copy_routing = yes
  no_more

I've probably got the host and port wrong above.

>
> Help on this would be warmly appreciated. Either a solution, or a
> redirection to upstream.
>
> Many thanks in advance,



More information about the Pkg-exim4-users mailing list