1

I have installed msmtp, and it seems to be working OK:

echo "Hello" | mail -s "Testing SmSMTP" [email protected]

The email arrives to destination, But the From field is a ugly email text like [email protected] . I mean: [email protected] is correct, of course, but I would like the receiver to read some more professional John Smith - Sales Department <[email protected]> , like it can be done on any other email client.

What is the proper way to achieve this with MSMTP?

Further notes:

  • I am running Ubuntu v20.04 .
  • I have installed the packages msmtp msmtp-mta mailutils.
Sopalajo de Arrierez
  • 6,281
  • 21
  • 60
  • 98

1 Answers1

0

I solved it this way:

$ printf "From: John Smith - Sales Department <[email protected]>\nSubject: Testing MSMTP\nHello." | msmtp -v [email protected]

Note that I used | msmtp instead of | mail . I am not sure if that is important, because, as long as you install the msmtp-mta package, sendmail is linked to msmtp``.

Note that you can enhance the destination field in the same manner, like:

$ printf "To: Mr. Destination Man <[email protected]>\nFrom: John Smith - Sales Department <[email protected]>\nSubject: Testing MSMTP\nHello." | msmtp -v [email protected]

Extracted from the ArchLinux Wiki.

Sopalajo de Arrierez
  • 6,281
  • 21
  • 60
  • 98