Sendmail from the command line

echo -e To: 'The Persons…

Login

Blog History

echo  -e To: 'The Persons Name ' \\n\\n Body of mail \
| /usr/sbin/sendmail -F "From Name" \
-f [email protected] -t [email protected]

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 [email protected] -t [email protected]

0 Comments

Submit a Comment

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.