How can I change displayed name as sender?
Solution 1
Don't use mail
, there are better command-line MUAs, such as mailx
(package bsd-mailx
) or mutt
.
mailx
will do what you want with the -r
flag:
echo Test. | mailx -r "Joe Sender <[email protected]>" -s Test [email protected]
You can likewise specify a display name for the recipient, by the way.
The nickname shown in for instance gmail.com comes from the part of the From
field that is outside <[email protected]>
, so in this example it would be Joe Sender.
Solution 2
Using mail
, you can set the username using the proper syntax, such as echo "Test" | mail -a "From: Someone <[email protected]>" [email protected]
.
stack
Updated on September 18, 2022Comments
-
stack almost 2 years
I send email from my server like this:
echo "This is the body of the email" | mail -s "This is the subject line" [email protected]
Noted that I replace
[email protected]
with a real email address. And it works. Just I need to know, where this nickname comes from?I use ubuntu 14.04 on the server and I want to know how can I change that name?
-
stack over 6 yearsGreat .. thank you .. upvote. Just in reality my problem is this. if you have some free time, please take a look at it.
-
bzero almost 4 yearsThis does not work. When I send an email to my google mail account, it only shows the address
[email protected]
but not the "Joe Sender"... -
bzero almost 4 yearsThanks! This is the only solution that works from all mentioned solutions...