Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify the from user when sending email using the mail command

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.

like image 850
Joel Cunningham Avatar asked Sep 23 '08 06:09

Joel Cunningham


People also ask

How do I specify an address from an email in Linux?

Specify CC and BCC We can also attach a bcc and cc address within a command. To attach a bcc and cc address, use the -b and -c options, respectively. To add a bcc address, execute the command as follows: mail -s "Hello World" <recipient address> -b userto< bcc address>

What is mail from command?

The MAIL FROM command initiates a mail transfer. As an argument, MAIL FROM includes a sender mailbox (reverse-path). For some types of reporting messages like non-delivery notifications, the reverse-path may be void. Optional parameters may also be specified.

Which command is used to send the mail in Linux?

ssmtp Command You need to add a subject with the keyword “Subject”. Then you'll type the message you want to convey to the email recipient. At the end of your message press Ctrl+D (^d) for sending the email.

What is mail command in Unix?

The mail command allows you to read or send mail. If users is left blank, it allows you to read mail. If users has a value, then it allows you send mail to those users.


1 Answers

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

$mail -s "Some random subject" -a "From: [email protected]" [email protected] 
like image 151
daniels Avatar answered Sep 21 '22 15:09

daniels