Sendmail – Set From Address
For years I have had to build the email header in a file in order to set the From address with sendmail. After some tinkering I devised a method of sending an email using a one liner. I have to admit, it is slick:
echo “Hello World” | formail -A ‘Subject: Test Subject!’ -A ‘From: sender@domain.com’ -A ‘To: recipient@domain.com’ | sendmail -oi -t
You may have to prefix echo, formail, and sendmail with paths if they aren’t in your own path.
Advertisement
Leave a Comment