Specify the from user when sending email using the mail command

Joel Cunningham picture Joel Cunningham · Sep 23, 2008 · Viewed 188.2k times · Source

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.

Answer

daniels picture daniels · Sep 23, 2008

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

$mail -s "Some random subject" -a "From: [email protected]" [email protected]