I use mutt as my e-mail reader, and nbSMTP as my SMTP client. I check e-mail from a half dozen accounts and sort them into miscellaneous folders in my maildir. Some of the folders are account-specific, but some contain e-mails from multiple accounts in one folder
A number of the accounts are through Gmail, which has the unfortunate security feature of preventing users from sending from addresses that aren't theirs. Thus if I tell nbSTMP to authenticate as
[email protected] and send an e-mail with a
From: [email protected] header, Gmail will rewrite the header to
From: [email protected].
I've worked around this somewhat by adding folder hooks for the folders that are account-specific; when I switch to one of those folders the hook changes my sendmail command to pass nbSMTP the appropriate command-line arguments:
folder-hook =work 'set from="[email protected]"' folder-hook =work 'set sendmail="/usr/bin/nbsmtp -f [email protected] -U work -P password"'
However, this doesn't work for the folders that hold mail from multiple accounts, and it doesn't work if I try to e.g. send e-mail from
[email protected] when I haven't switched to the
work folder (since the folder hook hasn't run). Is there a way to control how nbSMTP authenticates based on the
From header in the outgoing e-mail? I don't think nbSMTP has the flexibility to handle it itself, so I'm pretty sure it will have to be some kind of
mutt configuration like the
folder-hook method I'm currently using, but I haven't figured out how to do it. If necessary I can probably switch SMTP clients, if there's another that does provide the necessary functionality