0

I am a longtime mutt user (actually switched to neomutt) some time ago and there is one thing I never quite managed to configure to my liking:

I have several accounts that I map to several folders. I adjust my IMAP/SMTP credentials as well as mailboxes etc. via folder and account hooks. Since I also use sidebar, I can easily switch from one mail account to the next. I also adjust the 'From:' header via a folder hook, such that when sending an email, my name and email are chosen automatically to match the account I am sending from. If I want to reply to an email that was send to account A from account B, I usually copy/move the message from folder/server A to folder/server B, switch folders/accounts (letting those hooks do their thing) and reply from there. That is a bit cumbersome but happens rare enough so I do not really care.

However, I also happen to have two accounts/mailboxes that receive mail sent to several email-adresses (think me@my-domain.com, admin@my-domain.com, my-nickname@my-domain.com). I can send email from all of those by manually adjusting the 'From:' field when composing an email. However, I would like this to happen automatically when replying to an email: If I reply to an email that was sent to admin@my-domain.com, I do not want to reply from my-nickname@my-domain.com, even though this might be my preferred default configured via the my-domain folder/account hooks.

This answer suggests set reverse_name=yes to do just that (if I understood correctly) but adding that to my .neomuttrc didn't have the desired effect. I suspected the hook setting From: might override that setting and commented it out for testing, but now I simply compose/reply from my-local-user@hostname.

I am aware of but not interested in mutt-vid since it is way overkill for my simple needs: I am fine with manually setting my sender's address when starting a new email thread (in case I am not happy with the default configured through my hooks). So there is no need to learn the most likely most appopriate sender's address based on the recipient and past interaction. I just don't want have to remember to manually change my sender's address if I reply to an email I receive via a non-default address.

2 Answers 2

0

The way to do this is to enable the use_envelope_from option. If envelope_from_address is unset, neomutt will derive the sender from the From: header.

Just add the following to your config file:

unset envelope_from_address
set use_envelope_from
0

I also receive emails at multiple addresses (I create a new one for each online organisation I have to create an account with). Setting the reverse_name option works as expected for me – but that’s because I have the alternate addresses configured with a regular expression which matches all my email addresses – and I haven’t started using hooks (yet):

# When replying to an email, use the To: address of the original email as the
# From: address in the reply (requires that the To: address be recognised by
# Mutt as being one of my alternate addresses).
set reverse_name

# Let Mutt know what other email addresses are used by me.
alternates ^anthony@example.info$ @example
# I had been thinking of writing a script to dynamically create a file of
# alternative addresses from /etc/aliases but there’s no need to list them
# individually as – currently – all example.ie and example.info addresses
# are me so it is enough to just match the `@example` regular expression.

You might find it useful to also use the edit_headers option which allows the From address to be set manually in your text editor when composing a message:

# When composing a message, edit the headers along with the message body.
# This should make it easier to see that the correct From address is being used
# and to fix this if necessary.
set edit_headers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.