Sendmail SMART_HOST different credentials by sender



Reaction score: 3
Messages: 23

I want to be able to have outbound email relayed via a SMTP host (gmail), but using different credentials depending on the local sender.

So if I send mail from local account "foo" to, it might use credentials "", whereas if I sent the same mail from local user "bar" it would use credentials "".

In fact, this is almost identical to what's described in this nice post:

The unfortunate part is that it modifies directly, rather than, so you are always at risk of losing your changes if you rebuild your config.

That link above is from 2008, and most of the useful discussion I've found on the subject is from no later than 2010.
I figured that maybe modern Sendmail supports this better out-of-the-box?

Does anyone on here have experience with something like this?

Worst case, I found LOCAL_CONFIG and LOCAL_NET_CONFIG, which seem to be able to inject raw config rules via the .mc file, so maybe I could use them to avoid editing the .cf file directly, as in that post.

Any suggestions welcome — thanks.