My root user send emails with ssmtp. However I can't change "From: root ..." root name. Is there any way to send email with another name without using another user?
echo 'From: "New name" ' | ssmtp email@example.com -v
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
You can set up a reverse alias in
it's hidden at the bottom of the man page.
I suggest you switch from ssmtp to msmtp since ssmtp is not actively developed any more. msmtp provides all the same features as ssmtp plus more. In particular, with msmtp you can set the from setting to control who the mail appears to be sent from.
Change the 'From' text by editing
/etc/passwd to receive mail from 'YOUR NAME HERE' instead of just 'root'.
chfn -f 'YOUR NAME HERE' root
Check it using
grep root /etc/passwd
root:x:0:0:YOUR NAME HERE,,,:/root:/bin/bash
Found it here and it worked a treat!
-F option works if you are specifying the email params on the ssmtp command line, e.g.
echo "Test email" | ssmtp -F"New name" -v firstname.lastname@example.org
If you want all emails sent from root@ to come from a certain name, you can change the Linux user information as described in this StackOverflow answer:
chfn -f "New name" root
"What this does is setting/changing the real name for that user in the finger information (stored in the /etc/passwd file--see the chfn man page)."
Update Even after updating the finger information, cron is still sending email from "root", not using my "New name". Some versions of cron support a
MAILFROM= line, but not mine (see this article).