Running the sendmail command I usually get emails with sender like username@hostname
.
Is there a way to send emails using sendmail and having the sender set to something different from the user account used to run the command?
From the sendmail man page: -Ffullname Set the full name of the sender. -fname Sets the name of the ``from'' person (i.e., the sender of the mail). -f can only be used by ``trusted'' users (normally root, daemon, and network) or if the person you are trying to become is the same as the person you are.
Simple example Once logged in, you can run the following command to send email: [server]$ /usr/sbin/sendmail [email protected] Subject: Test Send Mail Hello World control d (this key combination of control key and d will finish the email.)
You can use the "-r" option to set the sender address: mailx -r [email protected] -s ... This is troubling for me because the man page of mailx says: "-r address Sets the From address. Overrides any from variable specified in environment or startup files.
What you're looking for is -f
:
sendmail -F "Your name" -f "[email protected]" < your-message.txt
From the sendmail man page:
-Ffullname Set the full name of the sender.
-fname Sets the name of the ``from'' person (i.e., the sender of the
mail). -f can only be used by ``trusted'' users (normally
root, daemon, and network) or if the person you are trying to
become is the same as the person you are.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With