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

Gary Dale gary at extremeground.com
Wed Oct 12 01:37:07 BST 2022

On 2022-09-13 16:19, Sébastien Hinderer wrote:
> Hey Ian,
>> Yes, that would be one simple solution.
> Well, not that simple (for me) actually, sorry.
>>> I'll wait a bit to see whether other suggestions come in
>>> and, if not, try this one. I am slightly reluctant because it  makes me
>>> create yet another thing (a transport) and it will mean that this one
>>> password will be apart from others, but if that's the only way I'll go
>>> for that.
>>> I guess, ideally, what would be nice would be that the smarthost
>>> transport would let a router specify a login and then it would be
>>> possible to pick the password from the passwd.client file. Just that the
>>> login should be able to contain @ signs because that's how GMail logins
>>> are and quite possibly other providers (HotMail?) would need the support
>>> for @ in logins.
>> Well, i wouldn't have this new transport look at a file that is
>> formatted like passwd.client. What I would do is look for some data that
>> is unique to the router, perhaps even the router name, then create a new
>> file format which uses that as the key for a lookup, and that goes in
>> the transport.
> Well as I said I think I could live with a password hard-coded in the
> dedicated transport but even that I don't know how to achieve.
> Basically, I can copy/past the "remote_smtp_smarthost" transport and
> create, say, a "copany_remote_smtp_smarthost" one but evenif I do that,
> the  thing I will need to change in the copied transport is the
> definition of "hosts_try_auth". Is there a syntax to write a login /
> passowrd / host in the definition of this macro directly?
> Sébastien.

A question: don't know if you covered this in parts of the conversation 
that aren't on the listserve, but if I got the issue correct, you want 
some e-mail to go through one account and other e-mail to go through 
another account.

This can be handled by using different passwd.client files for each 
client. I have a similar problem that I solve by changing the 
passwd.client file according to the account I want to send from. The 
advantage of doing this is that it requires no changes to exim4. The 
disadvantage is that I have to do it before sending e-mail from that 

This isn't a big deal for me because I don't do it often. However it can 
easily be automated in a wrapper script for your e-mail client if you a 
sending e-mail from the command line, which is how I use exim4. The 
wrapper would need privileges to cp the passwd.client.<from> files...

More information about the Pkg-exim4-users mailing list