How can I change displayed name as sender?

7,040

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].

Share:
7,040
stack
Author by

stack

Updated on September 18, 2022

Comments

  • stack
    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?

    enter image description here

    I use ubuntu 14.04 on the server and I want to know how can I change that name?

  • stack
    stack over 6 years
    Great .. thank you .. upvote. Just in reality my problem is this. if you have some free time, please take a look at it.
  • bzero
    bzero almost 4 years
    This 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
    bzero almost 4 years
    Thanks! This is the only solution that works from all mentioned solutions...