=head1 NAME

mailsend - A command line program to send mail via SMTP protocol

=head1 SYNOPSYS


 Version: @(#) mailsend v1.20b2

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

 (Compiled with OpenSSL version: OpenSSL 1.0.2q  20 Nov 2018)
 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)


=head1 DESCRIPTION

mailsend is a simple command line program to send mail via SMTP protocol 
for Windows, Linux/Unix.

For deatils, please look at the web page:

L<http://muquit.com/muquit/software/mailsend/mailsend.html>

=head1 EXAMPLES

Examples of mailsend Version: @(#) mailsend v1.17b15

  Show server info
  ================
   mailsend -v -info -port 587 -smtp smtp.gmail.com
   mailsend -v -info -ssl -port 465 -smtp smtp.gmail.com

  STARTTLS + AUTHENTICATION
  =========================
   mailsend -to user@gmail.com -from user@gmail.com
   -starttls -port 587 -auth
   -smtp smtp.gmail.com
   -sub test +cc +bc -v
   -user you -pass "your_password"
   Note: Password can be set by env var SMTP_USER_PASS instead of -pass

  SSL + AUTHENTICATION
  ====================
   mailsend -to user@gmail.com -from user@gmail.com
   -ssl -port 465 -auth
   -smtp smtp.gmail.com
   -sub test +cc +bc -v
   -user you -pass "your_password"

   As -auth is specified, CRAM-MD5, LOGIN, PLAIN will be tried in that order.
   Use -auth-cram-md5, -auth-plan, -auth-login for specific auth mechanism.

   Note: Password can be set by env var SMTP_USER_PASS instead of -pass

  One line messages
  =================
  One line messages are specified with -M. Each message can have its own
  MIME type, character set and encoding type:

   mailsend -f user@example.com -smtp 10.100.30.1
   -t user@example.com -sub "testing oneline messages"
   -cs "us-ascii"
   -enc-type "7bit"
   -M "This is a test"

   -cs "iso-8859-1"
   -enc-type "8bit"
   -M "Das Vetter ist schön!"

   -cs "Big5"
   -enc-type "base64"
   -M "中文測試"

  Attachments
  ===========
  Only requirement of -attach is the path of the file. All other 
  attributes can be specified before -attach with appropriate
  flags. Note: The flags must be specified correctly for each attachment,
  otherwise the one specified in previous attachment will be used.

  By default MIME type is guessed from filename extension, default 
  encoding type base64 is used:
   mailsend -f user@example.com -smtp 10.100.30.1
   -t user@example.com -sub "this is a test"
   -attach "file.pdf" -attach "file.jpg"

  But all espects of attachments can be controlled:
   mailsend -f user@example.com -smtp 10.100.30.1
   -t user@example.com -sub test
    -mime-type "text/plain" 
    -enc-type "7bit"
    -charset "us-ascii"
    -attach "file.txt"

    -enc-type "8bit"
    -charset "iso-8859-1"
    -attach "deutsch.txt"

   -mime-type "image/gif"
   -enc-type "base64"
   -aname "flower.gif"
   -attach "/usr/file.gif" 

   -mime-type "image/jpeg"
   -enc-type "base64" 
   -attach "file.jpeg"

  By default, content disposition of all atachments are attachment, use
  -disposition "inline" to give hint to the mail reader to display it as
  mail body. Look at FAQ# 1 for details.

  Including a body
  ================
  Only one file can be included as a body of the mail. If the
  file is not us-ascii, the SMTP server has to support it. If you 
  include a binary file, result is undefined.

   mailsend -f user@gmail -t user@example.com -smtp smtp.gamil.com
    -port 587 -starttls -auth -user user@gmail.com -pass secret 
    -charset "utf-8"
    -mime-type "text/plain"
    -msg-body "file.txt"


=head1 SEE ALSO

Please look at the web page for latest version and documentation:
L<http://muquit.com/muquit/software/mailsend/mailsend.html>


=head1 LICENSE

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.


=head1 AUTHOR

mailsend is written by Muhammad Muquit E<lt>muquit@muquit.comE<gt>.
Homepage: L<http://www.muquit.com/>.

