LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   send mail as other user from mail command. (https://www.linuxquestions.org/questions/linux-newbie-8/send-mail-as-other-user-from-mail-command-905362/)

linuxlover.chaitanya 09-28-2011 03:11 AM

send mail as other user from mail command.
 
Hello All,

I am trying to send mail using mail command. The command is run as "root" user and hence the receiver sees it coming from root. I want to send it as other user but without using "-r" flag or any other flag. The man page of the mail command also recommends not using this flag and instead using some FROM variable. Can anyone help in setting this variable and what variable is to be set exactly to masquerade as other user?

Regards
Chaitanya

snooly 09-28-2011 05:42 AM

I don't know which "mail" program you are using, so I can't be sure of this answer. But oh well, may as well try!

It might mean "set the environment variable FROM to the username you want". In that case, and assuming you use bash shell, you could try this:

export FROM=monkey@example.com
echo $FROM

Please check the manual pages for your mail program and your shell to figure out the correct answer.

man mail
man bash


All times are GMT -5. The time now is 10:49 PM.