Linux – Specify the from user when sending email using the mail command

emaillinuxredhat

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.

Best Solution

You can specify any extra header you may need with -a

$mail -s "Some random subject" -a "From: some@mail.tld" to@mail.tld