LKBDE11368: Wie man eine E-Mail unter Windows aus der Kommandozeile verschickt


Versenden einer Mail ohne GUI


Dies kann in vielen Situationen nützlich sein, z.B. in Skripten


Es gibt ein freies Tool, dass diese Funktionalität bietet: \"mailsend\"


mailsend -f -d -smtp -p 26 -t +cc +bc -sub %computername% -M \"content of the mail\"

Die Funktionen können über die Online-Hilfe angezeigt werden:

E:\\>mailsend /h

Version: @(#) mailsend v1.14

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

usage: mailsend [options]
Where the options are:
   -d    domain*          - domain name for SMTP Helo
   -smtp hostname/IP*    - of the SMTP server
   -p    SMTP port       - SMTP port
   -t    to,to..*        - email address/es of the reciepient/s
   -cc   cc,cc..         - Carbon copy address/es
   +cc                   - dont ask for Carbon Copy
   -bc   bcc,bcc..       - Blind carbon copy address/es
   +bc                   - dont ask for Blind carbon copy
   +D                    - dont add Date header
   -f    address*        - email address of the sender
   -sub  subject         - subject
   -l    file            - a file containing the email addresses
   -a    file,mime_type  - attach this file
   -cs   character set   - for text/plain attachments (default is us-ascii)
   -m    file,mime_type,[i/a] (i=inline,a=attachment)
                         - attach the file (text,html etc) as body (inline)
   -M    \"one line msg\"  - attach this one line text message
   -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
   -help                 - shows this help

The options with * must the specified
Example (Note: type without newline):

 mailsend -f -d -smtp
  -t -sub test -a \"file.txt,text/plain\"
  -a \"/usr/file.gif,image/gif\" -a \"file.jpeg,image/jpg\"

 mailsend -f -d -smtp
  -t -sub test +cc +bc
  -a \"c:\\file.gif,image/gif\" -M \"Sending a GIF file\"

 mailsend -f -d -smtp
  -t -sub test +cc +bc -cs \"ISO-8859-1\"
  -a \"file2.txt,text/plain\"

Change content disposition to inline:
 mailsend -f -d -smtp
  -t -sub test -a \"nf.jpg,image/jpeg,i\"
  -M \"content disposition is inline\"

Spamming is wrong! Just dont do it.


The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!

About the Author

Author: Wim Peeters - Keskon GmbH & Co. KG

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.