Sendmail to send mail

Jump to: navigation, search

mail delivery test with sendmail

This shows how to send a message from the commandline using sendmail. See also SMTP_test.

Create a message file:

Subject: test

This is a test message.

Use sendmail to send the message:

sendmail -t < message

In a script you could do something like this:

# This gives an example of sending an HTML message.
echo "From:"
echo "To:"
echo "MIME-Version: 1.0"
echo "Content-Type: multipart/mixed;"
echo ' boundary="BOUNDARY"'
echo "Subject: Test Message"
echo ""
echo "This is a MIME-encapsulated message"
echo "--BOUNDARY"
echo "Content-Type: text/plain"
echo ""
echo "This is what someone would see without an HTML capable mail client."
echo ""
echo "--BOUNDARY"
echo "Content-Type: text/html"
echo ""
echo "<html>
<body bgcolor='black'>
<blockquote><font color='green'>GREEN</font> <font color='white'>WHITE</font> <font color='red'>RED</font></blockquote>
echo "--BOUNDARY"
) | sendmail -t