zehm / sendEmail

SendEmail is a lightweight, command line SMTP email client. If you have the need to send email from a command line, this free program is perfect: simple to use and feature rich. It was designed to be used in bash scripts, batch files, Perl programs and web sites, but is quite adaptable and will likely meet your requirements. SendEmail is written in Perl and is unique in that it requires NO MODULES. It has an intuitive and flexible set of command-line options, making it very easy to learn and use. SendEmail is licensed under the GNU GPL, either version 2 of the License or (at your option) any later version. [Supported Platforms: Linux, BSD, OS X, Windows 98, Windows NT, Windows 2000, & Windows XP]
GNU General Public License v2.0
31 stars 17 forks source link

sendEmail

SendEmail is a lightweight, command line SMTP email client. If you have the need to send email from a command line, this free program is perfect: simple to use and feature rich. It was designed to be used in bash scripts, batch files, Perl programs and web sites, but is quite adaptable and will likely meet your requirements. SendEmail is written in Perl and is unique in that it requires NO MODULES. It has an intuitive and flexible set of command-line options, making it very easy to learn and use. SendEmail is licensed under the GNU GPL, either version 2 of the License or (at your option) any later version. [Supported Platforms: Linux, BSD, OS X, Windows 98, Windows NT, Windows 2000, & Windows XP]

sendEmail - Send email from a console near you! Written by: Brandon Zehm caspian@dotconf.net


Installation

SendEmail is a perl script/program, and only needs to be copied to a directory in your path to make it accessible. Most likely the following steps will be sufficient:

1) Extract the package tar -zxvf sendEmail-v1.XX.tar.gz

2) Copy the sendEmail.pl script (and it's symlink sendEmail) to /usr/local/bin cp -a sendEmail-v1.XX/sendEmail.pl /usr/local/bin

3) Make sure its executable chmod +x /usr/local/bin/sendEmail.pl

4) Run it sendEmail.pl or /usr/local/bin/sendEmail.pl or if it's symlinked to "sendEmail" and in your path, just run: sendEmail

NOTES:


Usage Overview

sendEmail-1.56 by Brandon Zehm caspian@dotconf.net

Synopsis: sendEmail -f ADDRESS [options]

Required: -f ADDRESS from (sender) email address


Examples

Send a simple email:

    sendEmail -f me@gmail.com      \
            -t friend@yahoo.com    \
            -s smtp.gmail.com:587  \
            -xu me@gmail.com       \
            -xp MY-PASSWORD        \
            -u "Test email"        \
            -m "Hi buddy, this is a test email."

Sending to mutiple people:

    sendEmail -f myaddress@isp.net \
            -t "Scott Thomas <scott@isp.net>" jason@isp.net renee@isp.net \
            -s relay.isp.net     \
            -u "Test email"      \
            -m "Hi guys, this is a test email."

Sending to multiple people using cc and bcc recipients: (notice the different way I specified multiple To recipients, you can do this for cc and bcc as well)

  sendEmail -f myaddress@isp.net \
            -t scott@isp.net;jason@isp.net;renee@isp.net \
            -cc jennifer@isp.net paul@isp.net jeremiah@isp.net \
            -bcc troy@isp.net miranda@isp.net jay@isp.net \
            -s relay.isp.net \
            -u "Test email with cc and bcc recipients" \
            -m "Hi guys, this is a test email."

Sending to multiple people with multiple attachments:

  sendEmail -f myaddress@isp.net \
            -t jason@isp.net \
            -cc jennifer@isp.net paul@isp.net jeremiah@isp.net \
            -s relay.isp.net \
            -u "Test email with cc and bcc recipients" \
            -m "Hi guys, this is a test email." \
            -a /mnt/storage/document.sxw "/root/My Documents/Work Schedule.kwd"

Sending an email with the contents of a file as the message body:

  cat /tmp/file.txt | sendEmail -f myaddress@isp.net \
                                -t jason@isp.net \
                                -s relay.isp.net \
                                -u "Test email with contents of file"

Sending an email with the contents of a file as the message body (method 2):

  sendEmail -f myaddress@isp.net \
            -t jason@isp.net \
            -s relay.isp.net \
            -o message-file=/tmp/file.txt \
            -u "Test email with contents of file"

Sending an html email: (make sure your html file has at the beginning)

  cat /tmp/file.html | sendEmail -f myaddress@isp.net \
                                 -t jason@isp.net \
                                 -s relay.isp.net \
                                 -u "Test email with html content"

Contributors

Many thanks go to the people who have submitted ideas and patches. I know I've forgotten to mention everyone who's helped with sendEmail, but here is a small list. Please let me know if you feel your name should be here!

v1.56