Need to set mailx variable to specify the From address

Posted by user256817 on Super User See other posts from Super User or by user256817
Published on 2013-09-23T23:08:16Z Indexed on 2014/06/07 9:28 UTC
Read the original article Hit count: 280

Filed under:
|
|
|

Running Oracle Linux 5.8 (which is just re-branded RedHat EL 5.8) I must change the From address. But we have scripts that use mailx which cannot be re-written to use any extra flags, so I'd like to use internal variables instead, which I see on the linux.die.net manpage on mailx is an alternative to the -r flag:

-r address
Sets the From address. Overrides any from variable specified in environment or startup files. Tilde escapes are disabled. The -r address options are passed to the mail transfer agent unless SMTP is used. This option exists for compatibility only; it is recommended to set the from variable directly instead.

(Source: http://linux.die.net/man/1/mailx)

How can we use these mailx variables? I tried adding this to /root/.mailrc, no go:

set [email protected]

I also added that to /etc/mail.rc with no gold. So I am turning to you, SuperUsers...

© Super User or respective owner

Related posts about linux

Related posts about redhat