Mailbox shows the sender name as "Apache", because the mail I am autosending is being sent from a Perl CGI program. How do I change it to something else?
Some Linux distributions link to mailx where you can use the -r from-addr parameter. If you have mutt you should be able to use mutt -e "set from='name <name@somewhere>'> . Other distributions which have the mail command should be able to use echo "test"|mail -s "subject" [email protected] -- -f from@address .
You can use the "-r" option to set the sender address: mailx -r [email protected] -s ... This is troubling for me because the man page of mailx says: "-r address Sets the From address. Overrides any from variable specified in environment or startup files.
You just need to add a From:
header. By default there is none.
echo "Test" | mail -a "From: Someone <[email protected]>" [email protected]
You can add any custom headers using -a
:
echo "Test" | mail -a "From: Someone <[email protected]>" \ -a "Subject: This is a test" \ -a "X-Custom-Header: yes" [email protected]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With