Does anyone know how to change the from user when sending email using the mail command? I have looked through the man page and can not see how to do this.
We are running Redhat Linux 5.
Does anyone know how to change the from user when sending email using the mail command? I have looked through the man page and can not see how to do this.
We are running Redhat Linux 5.
Thanks to all example providers, some worked for some not. Below is another simple example format that worked for me.
You can append sendmail options to the end of the mail command by first adding --. -f is the command on sendmail to set the from address. So you can do this:
mail recipient@foo.com -- -f sender@bar.com
For CentOS here is the working command :
None of the above worked for me. And it took me long to figure it out, hopefully this helps the next guy.
I'm using Ubuntu 12.04 LTS with mailutils v2.1.
I found this solutions somewhere on the net, don't know where, can't find it again:
Full Command used:
http://www.mindspill.org/962 seems to have a solution.
Essentially:
echo "This is the main body of the mail" | mail -s "Subject of the Email" recipent_address@example.com -- -f from_user@example.com
or