A program to send mail via SMTP from command line
Switch branches/tags
Clone or download
muquit Fix #140. Filepath was lower cased while calculating MIME-TYPE from
extensin. Allocate memory for filepath first, it was on stack before.
The bug can manifest itself depending on what was on the stack and how
long the filepath is.
Latest commit 233fdd2 Aug 29, 2018
Permalink
Failed to load latest commit information.
doc Typo in my fix earlier May 28, 2018
images fixed a typo in embed_image1.html Oct 5, 2014
libs Windows setsockopt() call with SO_RCVTIMEO takes ms as timeout instea… Aug 17, 2014
misc image can be embedded in HTML. new option -embed-image. many other sm… Dec 28, 2013
scripts updated copyright information May 25, 2014
test Mege with develop brnach. Fixes #108 #111 May 8, 2017
.gitignore -h Feb 23, 2014
COPYRIGHT Update year to 2017 Mar 28, 2017
ChangeLog.mediawiki Fix #140. Filepath was lower cased while calculating MIME-TYPE from Aug 29, 2018
Makefile.in Don't use make -C to change directory, it's not that prortable Aug 22, 2018
Makefile.nmake streamlined lot of code.. still very fragile Dec 15, 2013
NOTES.txt removed svn related notes Jun 20, 2015
README.asc Update year to 2017 Mar 28, 2017
TODO work in progress for content-transfer-encoding Jul 1, 2013
aclocal.m4 add to svn Mar 18, 2013
changelog.debian add to svn Mar 18, 2013
configure support DESTDIR Oct 14, 2013
configure.in lots of changes and fixes. look at ChangeLog for 1.17b13 for details. Oct 13, 2013
copyright.h Update year to 2017 Mar 28, 2017
examples.c . Dec 24, 2013
init_vs.bat bat file to initialize vs Feb 23, 2014
install-sh adding autoconf tools for configure Oct 13, 2013
mailsend.h Fix #140. Filepath was lower cased while calculating MIME-TYPE from Aug 29, 2018
main.c New option for setting the return-path (-rp) Mar 17, 2016
mime.types more cleanup on getting mime type from file extension Dec 16, 2013
mime_types.h more cleanup on getting mime type from file extension Dec 16, 2013
mkinstalldirs adding autoconf tools for configure Oct 13, 2013
setget.c In quiet mode (-q), list of one line attachments were still printed o… May 17, 2016
smtp.c Add CRLF to begining of all MIME boundary Mar 28, 2017
utils.c Fix #140. Filepath was lower cased while calculating MIME-TYPE from Aug 29, 2018

README.asc

mailsend v1.19

mailsend is a simple command line program to send mail via SMTP protocol. Long time ago, I needed to send a piece of alert mail from a program in a networked Windows machine, but could not find a simple program like this installed. So I wrote one. You might find it useful as well. The program does not use any config file and I plan to keep it that way. From version 1.17b1+, IPv6 is supported in all platforms. Suggestions, bug reports are always welcome. If you have any question, request or suggestion, please enter it in the Issues with appropriate label.

Download source/binary

To download source/binaries, please go to the releases page.

Bug fixes and stable features are merged from dev branch to master branch every now and then. Clone the repo if you want the latest code.

Supported Platforms

  • Microsoft Windows

  • Linux/Unix

  • Mac OS X

It should compile on any POSIX compliant system. Works on 64 bit systems.

Features

Few main features:

  • ESMTP Authentication

  • IPv6 transport

  • Attachments

  • Embed images in HTML

  • Send mail to a list of users

Versions

Latest stable version is 1.19

Released on May-17-2016. Please look at: ChangeLog.

Synopsis

 Version: @(#) mailsend v1.19

 Copyright: BSD. It is illegal to use this software for Spamming

 (Compiled with OpenSSL version: OpenSSL 1.0.2f  28 Jan 2016)
 usage: mailsend [options]
 Where the options are:
  -copyright            - show copyright information
  -4                    - Force to use IPv4 address of SMTP server
  -6                    - Force to use IPv6 address of SMTP server
  -smtp hostname/IP*    - Hostname/IP address of the SMTP server
  -port SMTP port       - SMTP port
  -domain    domain     - domain name for SMTP HELO/EHLO
  -t    to,to..*        - email address/es of the recipient/s
  -cc   cc,cc..         - carbon copy address/es
  +cc                   - do not ask for Carbon Copy
  -ct   seconds         - Connect timeout. Default is 5 seconds
  -read-timeout seconds - Read timeout. Default is 5 seconds
  -bc   bcc,bcc..       - blind carbon copy address/es
  +bc                   - do not ask for Blind carbon copy
  +D                    - do not add Date header
  -f    address*        - email address of the sender
  -sub  subject         - subject
  -list_address file    - a file containing a list of email addresses
  -log file             - write log messages to this file
  -cs   character set   - for text/plain attachments (default is us-ascii)
  -separator character  - separator used with -attach. Default is comma (,)
                          If used must be specified before -attach
  -enc-type type        - encoding type. base64, 8bit, 7bit etc.
                          Default is base64. Special type is "none"
  -aname name           - name of the attachment. Default is filename
  -content-id id        - content-id in the attachment
  -mime-type type       - MIME type
  -dispostion val       - "attachment" or "inline". Default is "attachment"
  -attach file,mime_type,[i/a] (i=inline,a=attachment)
                        - attach this file as attachment or inline
  -show-attach          - show attachment in verbose mode, default is no
  -show-mime-types      - show the compiled in MIME types
  -M    "one line msg"  - attach this one line text message
  -content-type type    - Content type. Default: multipart/mixed
  -msg-body path        - Path of the file to include as body of mail
  -embed-image image    - Path of image to embed in HTML
  -H    "header"        - Add custom Header
  -name "Full Name"     - add name in the From header
  -v                    - verbose mode
  -V                    - show version info
  -w                    - wait for a CR after sending the mail
  -rt  email_address    - add Reply-To header
  -rrr email_address    - request read receipts to this address
  -rp                   - return-path address
  -ssl                  - SMTP over SSL
  -starttls             - use STARTTLS if the server supports it
  -auth                 - try CRAM-MD5,LOGIN,PLAIN in that order
  -auth-cram-md5        - use AUTH CRAM-MD5 authentication
  -auth-plain           - use AUTH PLAIN authentication
  -auth-login           - use AUTH LOGIN authentication
  -user username        - username for ESMTP authentication
  -pass password        - password for ESMTP authentication
  -example              - show examples
  -ehlo                 - force EHLO
  -info                 - show SMTP server information
  -help                 - shows this help
  -q                    - quiet

 The options with * must be specified
 Environment variables:
  SMTP_USER_PASS for plain text password (-pass)

The options with asterisk must be specified. Environment variable SMTP_USER_PASS can be used to set the SMTP authentication password instead of the option -pass

How to compile/install

Linux/Unix/Mac OS X

Specify the path of OpenSSL with --with-openssl. In most Linux systems, it is installed in /usr. If OpenSSL is installed in non-standard places, type ./configure --help for options.

   $ /bin/sh ./configure --with-openssl=/usr

Default installation location is /usr/local. If you want to change that:

   $ /bin/sh ./configure --with-openssl=/usr --prefix=/usr/local/mailsend
   $ make clean
   $ make
   # make install
   Or
   $ sudo make install
   Or
   $ make install DESTDIR=/foo

The name of the binary will be mailsend. If compiled with OpenSSL, the support for STARTTLS and SMTP over SSL will be available.

Linux Debian package

Starting from mailsend v1.18, Debian package is no longer supplied. If you want to build the Debian package yourself, after compiling mailsend, type:

   $ ruby scripts/mk_debian_package.rb

To install the package, type:

   $ sudo dpkg -i mailsend_1.19-ubuntu_i386.deb

To uninstall, type:

   $ sudo dpkg -r mailsend

Microsoft Windows

A compiled binary with SMTP authentication support for MS Windows is already supplied. However, if you need to modify something or want to compile it yourself, you will need freely available Visual Studio from Microsoft. For Visual Studio 2015 community edition, start Developer Command Prompt for VS2015.

OpenSSL is required, if you need to compile with SMTP authentication support. Look at INSTALL.32 that comes with OpenSSL on how to compile and install OpenSSL. mailsend’s Makefile.nmake expects it to be installed at c:\openssl

To compile mailsend, open a command shell and type:

   c:\> nmake -f Makefile.nmake clean
   c:\> nmake -f Makefile.nmake

It compiles cleanly with cygwin as well. The name of the binary will be mailsend.exe

Known Issues

  • For text or html attachments, \r\n is not added at the end of lines. Some SMTP servers (e.g. qmail) does not like that. It will be fixed in some future release.

  • For non ascii characters, MIME headers are not converted as per RFC2047

  • In Windows, non ascii characters can not be entered in subject or with -M from command line (Works fine in Linux and Mac). mailsend uses standard C string functions and Windows versions do not know about multibyte input from command line (Issue# 14). If anyone is familiar with it, you are welcome to implement the support, unfortunately I do not have time at this time.

FAQ

Please look at mailsend FAQ

Examples

Please type: mailsend -example or look at examples

License

BSD

To display license, please type: mailsend -copyright

Copyright (C) 2001-2017  Muhammad Muquit (http://www.muquit.com/)

 o Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

 o Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

 o Neither the name of the author MUHAMMAD MUQUIT (http://www.muquit.com/)
nor the names of its contributors may be used to endorse or promote
products derived from this software without specific prior written
permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

This document is created with AsciidocFX