How to change sender name or email address in mutt?

How do I change the sender name or email address ( From: header) used by mutt ?

+47
unix mutt
Aug 28 '12 at 11:22
source share
6 answers

Typically, mutt sets the From: header based on the from configuration variable you set to ~/.muttrc :

 set from="Fubar <foo@bar>" 

If this is not set, mutt uses the EMAIL environment variable by default. In this case, you can get away with a mutt call like this on the command line (as opposed to the way you showed it in your comment):

 EMAIL="foo@bar" mutt -s '$MailSubject' -c "abc@def" 

However, if you want to edit the From: header during linking, you need to configure mutt so that you can edit the headers first . This includes adding the following line to your ~/.muttrc :

 set edit_headers=yes 

After that, the next time you open mutt and compose E-mail, your selected text editor will also appear with headers so you can edit them. This includes the From: header.

+51
Aug 28 2018-12-12T00:
source share

If you want to change it once, you can specify the 'from' header on the command line, for example:

 mutt -e 'my_hdr From:obama@whitehouse.org' 

my_hdr is a mutt command to provide a custom header value.

One last word, don't be evil!

+20
Jan 21 '13 at 4:21
source share

before sending the email, you can press <ESC> f (Escape and then f) to change the From: address.

Restriction: This only works if you use mutt in curses mode and do not want to use it script, or if you want to change the permanent address. Then other solutions will be better!

+16
Mar 14 '14 at 19:43
source share

One of the special cases for this is to use the ~ / .muttrc file:

 # Reset From email to default send-hook . "my_hdr From: Real Name <email@example.com>" 

This response will overlap one of the following:

 mutt -e "set from=email@example.com" mutt -e "my_hdr From: Other Name <otheremail@example.com>" 

Your messages will still be displayed with a heading:

 From: Real Name <email@example.com> 

In this case, the only command line solution I found actually overrides the sender itself:

 mutt -e "send-hook . \"my_hdr From: Other Name <otheremail@example.com>\"" 
+8
Aug 03 '13 at 1:51 on
source share

for a one-time change, you can do this:

export EMAIL='sender@somewhere.com '; mutt -s "Elvis is dead" receiver@somewherelse.com

+4
Jul 03 '13 at 12:28
source share

100% Work!

To send the HTML content to the mail body in a path with the mail address of the sender and recipient on the same line, you can try the following:

 export EMAIL="sender@example.com" && mutt -e "my_hdr Content-Type: text/html" -s "Test Mail" "recipient@example.com" < body_html.html 

File: body_html.html

 <HTML> <HEAD> Test Mail </HEAD> <BODY> <p>This is a <strong><span style="color: #ff0000;">test mail!</span></strong></p> </BODY> </HTML> 

Note. Tested on RHEL, CentOS, Ubuntu.

0
Dec 16 '17 at 4:33
source share



All Articles