3

Background

I 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. [email protected]. If an email address is compromised and I start receiving spam, I can delete the account, creating a new one at [email protected]. (This works very well; I've deleted about 30 email addresses in 7 years, and receive zero spam.)

Mutt functionality

I'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.

  1. 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.
  2. 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.

2 Answers 2

7

You can configure mutt to use different from addresses (via your ~/.muttrc), e.g.:

set use_from = yes
set envelope_from = yes
set from = [email protected]
set realname = "Default Realname"
# list of all your addresses
alternates @example\.org$

You can setup some macros to explicitly switch the from before composing a new mail:

macro index \e1 "set [email protected]\n" "Select foo address"
macro index \e2 "set [email protected]\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=yes

Don't reuse the real name - helps when people send you crap like "[email protected]" <[email protected]>:

set reverse_realname=no

Then 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.

2
  • Thanks for the detailed answer (+1). However, it seems that one does have to explicitly list every potential address in alternates? I probably have over a hundred, and I'd add new addresses quite frequently. Is manual curation the only solution? And is it easy to manually alter the send address when necessary? The MTA should be fine, but I expected to have the most trouble with my point 1 above. I'll check out the hooks. I'm probably at the stage where I should just have a play myself.
    – Sparhawk
    Aug 16, 2015 at 13:15
  • 1
    To update on my unanswered questions in the comments, alternates takes a regex, so there is no need for manual curation. Modifying the send address is easy, either while composing the email (with set edit_headers=yes), or after composing the body. I've also added an answer addressing part 1.
    – Sparhawk
    Nov 2, 2015 at 22:41
1

To allow functionality similar to "Virtual Identity", here is a similar project for mutt. It requires regular scanning of sent emails, which could be set up as a cron job. It then creates a database of send-hooks, associating a sender email with each recipient. Due to limitations in mutt, it's a bit less interactive than Thunderbird's Virtual Identity. For example, if there are multiple recipients associated with conflicting sender email addresses, it can't really resolve this neatly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .