Sendmail from the command line

Written by James McDonald

May 29, 2009

echo  -e To: 'The Persons Name ' \\n\\n Body of mail \
| /usr/sbin/sendmail -F "From Name" \
-f from@address.com -t to@address.com.au

Where -e says I want to interpret \\n as a newline.
-F is the from description
-f is the from address
-t is the to address

Example:

export MYVAR=Hello
echo -e To: "I\'m A loser baby "\
\\nSubject: 'A test subject'\\nX-Custom-Header: \
\"$MYVAR My custom Header with escaped double quotes allow variable interpolation\"\
\\n\\n Body of mail | /usr/sbin/sendmail -F "Send Me A Winder" \
-f now@nw.com -t james@jamesmcdonald.id.au

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like…

PDF Poster

PDF Poster

Start with a wide long image. This is just a screen shot of my desktop. widescreen.png Convert it to postscript using...

Scribus to PDF Print

Just using Scribus to design and print some lapel cards Regarding Scribus - It seems that the stable version will not...