How to send email from the command line with specified sender on Debian Wheezy with Exim4?
I have search for ages trying to find out how to do this:
How can I send email from the command line and specify the sender address on a box with Debian 7.8 and Exim4?
This does not work:
mail -s "Subject of the Email" [email protected] -- -f [email protected]
Neither does this:
mail -s "Subject of the Email" -r [email protected] [email protected]
Solution 1:
I alwais use mailx
for sending mail from the command line for example from crontab, procmail and so on.
Mailx comes with package bsd-mailx.
echo "This is the mail body" | \
mailx -s "This is the subject" [email protected] [email protected]