BackgroundI own a domain with a catch-all, so that all email sent to *@foo.bar goes to one account. I have unique usernames for particular organisations, e.g. stackexchange@foo.bar. If an email address is compromised and I start receiving spam, I can delete the account, creating a new one at stackexchange2@foo.bar. (This works very well; I've deleted about 30 email addresses in 7 years, and receive zero spam.)Mutt functionalityI'm thinking about moving from Thunderbird to Mutt as my email client. However, one Thunderbird add-on that I use extensively is Virtual Identity. This allows me to manually type in the sender address, and can also automatically modify this address in two ways.It saves a database of previous recipients linked with the previously-used sender address. Next time I send an email to a particular recipient, it will automatically fill the sender field with the previously-used address.If the recipient is new, and I reply to an email, then it will automatically fill the sender field with the address the original email was sent to.Is there a way for Mutt to do these three functions (in bold above)? I understand that the final point is somewhat possible, although that solution requires setting up a list of potential sender addresses, rather than automatically allowing all senders in *@foo.bar.
Can I automatically send from specific email addresses in Mutt?
email;mutt
You can configure mutt to use different from addresses (via your ~/.muttrc), e.g.:set user_from=yesset envelope_from=yesset from=default@example.orgset realname=Default Realname# list of all your addressesalternates @example\.org$You can setup some macros to explicitly switch the from before composing a new mail:macro index \e1 set from=foo@example.org\n Select foo addressmacro index \e2 set from=bar@example.org\n Select bar address# ...When replying to an email, you can configure mutt to automatically use the to-header as from address (this is point 2 from your question):set reverse_name=yesDon't reuse the real name - helps when people send you crap like foo@example.org <foo@example.org>:set reverse_realname=noThen you can set up some hooks to make things depend on header values - e.g. to use different fcc folders:fcc-hook '~f ^foo@example\.org' '=foo'(There are also other hooks, like send-hook etc.)I would look into the hooks to implement something like point 1 from your question. Although, you would need some external scripting to maintain such a database.Depending on your current MTA setup you may have to change its config as well, i.e. such that it accepts different envelope froms.It is also possible to use different SMTP relays depending on e.g. the hostname of the envelope from - but this must be configured in the MTA.