/SendmailViaSMTP

A command line tool for sending mail via SMTP and support Linux, Windows, MacOS, BSD etc.

Primary LanguagePython

README

What is SendmailViaSMTP

SendmailViaSMTP is an easy used command line kit for sending mail via smtp server which can use in multiple platforms like linux, BSD, Windows etc. Like msmtp but don't need compile and install in each machine. Just copy SendmailViaSMTP.py to any machine which had python installed. SendmailViaSMTP is distributed under the BSD license.

Where is SendmailViaSMTP

Features

  • Accept data from pipe as email body.
  • Tls support. This means we support sending mail using gmail.
  • Multi recipient support.
  • Multi system supported, like Linux, BSD, Windows etc.
  • NEW: Attachments support(using -a/--attach option, see help message for more).
  • log support. use --log option for debugging.

Requirements

How to use SendmailViaSMTP

Download

  1. Git clone(recommend)

    $git clone https://github.com/leopku/SendmailViaSMTP.git

  2. Download
    1. Dowload last source code zip/tar.gz package from http://github.com/leopku/SendmailViaSMTP/archives/master
    2. Download last package uploading by developer from http://github.com/leopku/SendmailViaSMTP/downloads

Run SendmailViaSMTP.py in terminal

  1. pipe mode1

    $echo "contents from pipe." | python SendmailViaSMTP.py --host="mail.domain.com" --from="myname@yourdomain.com" --to="friends1@domain1.com;friends2@domain.com" --user="myname@yourdomain.com" --password="p4word" --subject="mail title"

  2. file mode

    $python SendmailViaSMTP.py --host="mail.domain.com" --from="myname@yourdomain.com" --to="friends1@domain1.com;friends2@domain.com" --user="myname@yourdomain.com" --password="p4word" --subject="mail title" --file="/path/to/file"

  3. option mode

    $python SendmailViaSMTP.py --host="mail.domain.com" --from="myname@yourdomain.com" --to="friends1@domain1.com;friends2@domain.com" --user="myname@yourdomain.com" --password="p4word" --subject="mail title" --content="contents from option"

NOTE: The priority of three mode: pipe mode, file mode, option mode.

TODO


  1. pipe mode is very useful while working with nagios etc.