Hi I have a script to send out email from a particular email address. Please correct it so that I can send mail using this script.
#!/bin/bash # script to send simple email # Email To ? EMAIL="sending_to_address" # Email text/message EMAILMESSAGE="/mailmessage.txt" /bin/mail -s "SUBJECT" "$EMAIL" < $EMAILMESSAGE -- -f from_email_address
Still I am getting email from the hostname of the server rather than the email address I have mentioned (from_email_address). I am not trying to send spoof mail outside. It is for internal use only (for my backup server)
Heirloom Mail, or mailx, the default
-r option for this, not
-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.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.