Change "from" address in Terminal `mail`
When sending mail from shell, e.g.,
echo '123' | mail -s 'subject' [email protected]
The recipient gets an email from "[email protected]", e.g., "[email protected]"
How can I change this to an email address of my choosing?
Solution 1:
Tack an escape to the end of your mail command to pass a header to sendmail.
-- -f [email protected]
See this answer and others that use the -- terminator to tell the mail program those arguments are for the next program.
- https://stackoverflow.com/a/8483239/475228