3

My institution is changing its name... and my professional e-mail is changing.

So far my .muttrc had:

alternates me@oldpro.com
alternates me@perso.com
set from=me@oldpro.com
set use_from

so that I replied to e-mails sent to my pro address with my pro address, and to personal e-mails with my personal address.

Now my new professional address is me@pro.com, I want to reply to professional e-mails with this, but not to personal. I of course update set from. If in addition I simply change my pro address in alternates, I have several drawbacks:

  • E-mails I sent with my oldpro address are not recognized as sent by me anymore, so when listing folders I see they were sent by me@oldpro.com, not to whom I sent them.
  • When replying to e-mails sent to several addresses including my oldpro address, this oldpro address get CCed.

Is there a better way out?

2 Answers 2

2
+25

Use hooks. You need to tell Mutt what is professional email and what is not.

If your professional recipients all use the @pro.com domain, and your personal contacts never use it, you could do:

alternates me@oldpro.com
alternates me@perso.com
set from=me@oldpro.com
set use_from

send-hook "~t '@pro.com$'" 'my_hdr From: John Smith <me@pro.com>'

Mail to all @pro.com recipients will use your professional mail. All the others would use the mail defined by set from.

If some of your contacts use the new @pro.com as personal mail, I am afraid you would have to add a send-hook line for each of these exceptions, per user basis.

You should keep as alternates all what is considered to be coming from you, even the addresses you are not using anymore.

2
  • Thanks Tony. Am I correct that this solution sets the From address according to the recipient? It is not convenient for me as I receive a lot of professional e-mails from many different domains. When replying to an e-mail, I'd like to select the From address according to the address that the recipient used to reach me. Feb 6, 2016 at 11:05
  • Maybe you can suggest an improvement on my failed attempt with a send-hook following your answer, see my edit in the question. Feb 6, 2016 at 11:12
1

I have found a configuration which does the required trick, as far as I could test so far. Following @Tony's advice, I keep my oldpro address in the alternates and am using a send-hook to rewrite it.

alternates me@oldpro.com
alternates me@pro.com
alternates me@perso.com
set from=me@pro.com
set use_from
send-hook . 'unmy_hdr From:'
send-hook '~f me@oldpro.com' 'my_hdr From: me@pro.com'

The first send-hook is needed since " if a hook changes configuration settings, these changes remain effective until the end of the current mutt session. As this is generally not desired, a default hook needs to be added before all other hooks to restore configuration defaults" according to Mutt user's manual — I don't think it very intuitive but so it is.

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.