Lion Soft Inc.

Excel Reporting Solution Provider

  • Home
  • Products
    • Tools for Oracle Reports
      • Rep2excel
      • Rep2excel Server
      • RepExpert
    • EasyHA Monitoring Tools
    • GTD Excel Report Server
    • Command Line Send Email Component
  • Purchase
    • Rep2excel & Rep2excel Server
    • RepExpert
  • FAQ
    • Rep2excel & RepExpert
    • EasyHA
  • Blog
    • Excel Reporting
    • Monitoring
    • Rep2excel

How to send email from command line through Gmail or hotmail account in windows

September 16, 2015 williamsvoon Command Line Email

Introduction

Your applications may generate reports and log files every day. And you may get asked by managers is "couldn't you just email that report to me?"

The most popular email client in Windows is Microsoft Outlook, however, it does not support command line.

Can I send email just through command line in Windows? If so, I can send email by batch file, and the email can be sent by schedule task.

This How-To describes using CmdEmail Pro and a gmail/hostmail account to extend the automatic generation of reports and send the reports and any files to your manager.

Steps

1. Download CmdEmail Pro from this link:

https://www.lv2000.com/products/cmdemailpro.zip

2. CmdEmail Pro Edition Usage

    Command Line Send Email Component (version 2.6)
Usage: sendmail [-to:] [-i:] [-a:]
  -to:<recipients>   Specify the recipients
  -m:<file path>     Specify the file contains message to be sent
  -user:<user name>  Specify the user name used to login SMTP server
  -pwd:<password>    Specify the password used to login SMTP server
  -a:<file path>     Specify the file to be attached with the mail
  -compress          Compress the attachments.
  -zippwd:<password> Specify password used to protect the zip file.
  -subject:<subject> Specify the subject.
  -body:<the body>   Specify the message body.
  -html              Send mail in html format.
  -firstline:<first line> Insert the first line before body.
  -setup             Change email account settings etc.

3. Setup your email account.

Before send email, you should have an email account. In this article, we use the free Gmail account. You are better off using your own business email account, and the smtp server is owned by your company.

Please run sendmail.exe -setup

Fill in account information and click OK.

Note:

Your Name: Name of sender

Email Address: Email address of sender

Outgoing SMTP Server: Name or IP address of the SMTP server. For example: smtp.live.com

Server requires authentication: check it in most case, because most smtp server requires authentication.

SSL/TLS enabled: Instructs the program to send the email using SSL. Using the ssl switch can often solve problems where the server expects a STARTTLS command.

User Name and password: User name and password used for authentication. The pasword will be encrypted and saved to file system.

 

  4. Run command line to send email.

sendmail.exe -to:name@example.com -subject:"test message" –a:c:\path\report.txt

Advanced

Compress the attachment

Please append -compress to the command line, the CmdEmail will compress the attachment before send it.

Specify more parameters

In case you want to specify more parameters, for example, send copy to other recipients, please create a message file, and pass the path of the file by command line.

There is a empty line between header and body. The following is an example:

to:scott@tiger.com
cc:bill@microsoft.com
subject:hello scott
attachment:https://www.lv2000.com/sendmail.htm

First line of the body.
Second line.

Save the text above to C:\temp_name.txt . Run CmdEmail again, e.g.

sendmail -m:c:\temp_name.txt

CmdEmail will read information from the message file, then send a mail to sott@tiger.com, copy to bill@microsoft.com .

Send rich format email

Please append -html to the command line. To get more information please view the document of CmdEmail.

 

Recent Posts

  • True Silent Printing PDF on Web based Application
  • Print report from your html page without ActiveX add-on
  • How to send email from command line through Gmail or hotmail account in windows
  • About the TimeOut directive in Apache configuration file
  • How to run java-rep2excel as Windows service

Archives

  • June 2016
  • May 2016
  • September 2015
  • August 2015
  • July 2015

Categories

  • Command Line Email
  • Excel Reporting
  • GTD Printing Tool
  • Monitoring
  • Rep2excel

Contact us

To contact our sales office regarding product/pricing inquiries, please send email to sales@lv2000.com.

You can also click the link below to send us message quickly.

Menu

  • Send us a message

Support

Feedback, questions and bug reports are welcome.
Customer support: support@lv2000.com.

Archives

  • June 2016
  • May 2016
  • September 2015
  • August 2015
  • July 2015

Categories

  • Command Line Email
  • Excel Reporting
  • GTD Printing Tool
  • Monitoring
  • Rep2excel

Recent Posts

  • True Silent Printing PDF on Web based Application June 23, 2016
  • Print report from your html page without ActiveX add-on May 27, 2016
© Lion Soft Inc.