I have spent 3h on this topic, so let's share my solution.
Initially, my smarthost was sending all messages via Gmail, using always the same gmail-account. This means ... Gmail may accept sending all emails with a FROM:user field, as long as the user is know in the gmail-account, but, even then, it will ALWAYS add a RETURN-PATH:A. So, when sending messages with FROM:B, gmail will add a RETURN-PATH:A . For most people, this is harmless, because most MUA will use the FROM to reply to. BUT ... some MUA will use the RETURN, and messages sent from account B will get replies to account A.
This is a quick a dirty fix to handle only one specific account B, and will leave account A as fallback.
I got inspired from this page:
http://www.linuxer.onlinehome.de/apps/exim.htmwhich in short states:
- Code: Select all
# example for /etc/exim/passwd.client
# email@adr.se:email@adr.se:localuser:mail.server.net:loginname:password
# 1 2 3 4 5
# route_list = "* ${extract{3}{:}{${lookup{$sender_address}lsearch{/etc/exim/passwd.client}{$value}fail}}} bydns_a"
In the RELAY section, I changed this:
< hide client_send = : Account : Apass
---
> hide client_send = ": ${if eq {$sender_address} {Baccount}{Baccount}{Aaccount} } : ${if eq {$sender_address} {Baccount}{Bpass}{Apass} }"
Account names and passwords are written in plain text in my exim.conf file. It works because I don't use nasty letters. I could not find a way to group the user and password in a single IF section.
This could be escaladed for a 3rd user, but it may become PITA to nest several IF. A cleaner solution for 3+ accounts would be to use {CONFDIR/passwd.client} , with one line per account, plus a fallback line.
But in my very specific case, I will stick to this dual acounts dirty solution for a few more years.