10

Okay so here's the deal. I've got a school email adress (say romeo@school.com) that is held on an outlook server. Because I really dislike outlook, I have this mail forwarded to a gmail address (say romeo@gmail.com).

I've managed to set up mutt and gmail so that when I send a mail from the gmail account, it seems as if it is sent from the school account (the "from" and "reply-to" fields show romeo@school.com instead of romeo@gmail.com).

Now, I've started using the gmail account as a normal email address too (putting that in contact info) so poeple start mailing me at romeo@gmail.com, yet some poeple still email me at romeo@school.com.

Is there a way to set up mutt and gmail so that it automagically replies using the correct email address (eg the one the mail was sent too in the first place)?

romeovs
  • 5,785
  • 9
  • 43
  • 74

2 Answers2

14

First, you have to also set up your gmail, so it sends e-mail from both addresses.

Then you can add to lines in .muttrc:

alternates "romeo@school.com|romeo@gmail.com"
set reverse_name
  • FYI, I was using regexp like alternates `alternates ^mail@foo.bar$ ^other@myfoo.baz$ ` which didn't work, whereas this solution works. – Aif Mar 24 '17 at 15:56
2

You can use the folder-hook directive if you store your mails in folder.

folder-hook .      "set from=romeo@gmail.com"
folder-hook school "set from=romeo@school.com" 

Otherwise you can use send-hook

send-hook '~t ^romeo@school\.com$' 'my_hdr From: romeo@school.com'

Look at the this page for hooks.

undx
  • 191
  • 5