How to change the sender mail id in RHEL 7
Changing sender mail id in "mailx" command before RHEL 7
echo " Running out of space $mountpoint on `date` " | mail -s "Critical Alert: Almost out of disk space $mountpoint" recipient@abc.com -- -f sender@abc.com
Now I receive the alert mail from the mail id "sender@abc.com"
But in RHEL 7 -f is not usable. So to change the sender mail id in RHEL 7 follow the below steps
1. Create a file $HOME/.mailrc and make the below entries in the file
set from = "sender@abc.com"
2. Now use the mailx command like below in RHEL 7
echo " Running out of space $mountpoint on `date` " | mail -s "Critical Alert: Almost out of disk space $mountpoint" recipient@abc.com
3. Now the sender mail id is changed.