You are on page 1of 3

Send Automated Emails Using SendEmail & Windows Task

Written by Ryan Dube
July 28, 2010


<firstimage=>No matter what

your job is, usually everyone at some point has to email a boss or supervisor with daily, weekly or
monthly status reports. A lot of time this is nothing more than sending over a spreadsheet of data,
logfiles or other reports that are usually automatically generated.
Gathering the data and generating reports may not be a big deal for you, but remembering to write
up that email every so often can turn into a real hassle. And if you forget once or twice, it looks like
youre not on top of your game.
This is where your computer comes in handy.

Most Windows users know about the Windows Task Scheduler ( by now. In this article, Im going to show you how you can use Windows Task Scheduler in combination with the awesome
SendEmail ( SMTP command-line tool to send off scheduled, automated emails that
include multiple attachments.

Configuring SendEmail to Correctly Send Reports

The task here is fairly simple. You have a directory where several automated reports are stored. Maybe its a logfile summary for servers that
you support, which you need to forward to your supervisor. Maybe its an Analytics traffic report that you need to forward to your website
clients. Regardless of the need, this technique will let you automatically fire off an automated report email that will include as many of those
attachments that you need to send. So long as you have a system set up to automatically update those files before the scheduled email goes
out youll have a completely automated reporting system.
Heres how it works. Lets say I send out three Google Analytics reports that I generate and download every Thursday and I store them in a
directory called C:/Analytics. When you download SendEmail from the link above, theres no setup required. Just place it in any directory
where youd like to run it from. In this case Im just placing it in the same directory, so that I dont have to include the directory path to the
attachments in my command line.

Linux users have been using the sendmail command for ages, so this isnt really new to them, but the Windows compatible SendEmail
tool is something that lets Windows users have the same sort of command-line functionality. Once you have the executable sitting in a
directory like this, as long as you know the syntax, you can do a lot of cool stuff with the tool.

When you issue the SendEmail command at the command prompt (or run it from an application), you have to follow it with a number of
parameters. The critical ones that we are concerned with are shown in the examples below.


: This parameter is the email address that will be the sender.


: This is the recipients email address.

-u Monday Status Updates

: This is the subject

-m Heres the analytics data for this week!

: This is the message body.

-a Analytics_Channel1.csv Analytics_Channel2.csv Analytics_Channel3.csv

-xp A1ienz2A51

: SMTP server and port

: SMTP authentication ID name

: SMTP authentication password

Sign up for more tips and awesome articles

-o tls=yes

: These are the attachments.


: SMTP uses TLS (or SSL)

Let's go

These are all of the parameters youll need to complete the task that Im detailing in this article. Once youve downloaded the SendEmail.exe
file to your computer, youre ready to use Windows Task Scheduler to issue your SendEmail automated email command every day, week, or

Setting Up Windows Task Scheduler

Open up Windows Task scheduler by going to Start->Programs->Accessories->System Tools->Task Scheduler. Click to create a basic

This will walk you through the task scheduling wizard, where you can assign any calendar schedule youd like for these emails to get sent.

On the next screen, select Start a Program and then youll see the screen where you need to set up the task. This is where youll enter the
path for your SendEmail executable and the parameters.

The entire argument line that I typed in was as follows:

-f -u Monday Status Updates -m Heres the analytics data for this week! -a Analytics_Channel1.csv -t -s -xu -xp xxxxxxx -o tls=yes

Refer back to the parameter list above, but as you can see this sends out an email from your Gmail account to a recipient who has a Yahoo
account with a subject line, Heres the analytics data for this week! When this task runs (which will run every week), it fires off your
message and attaches the file attachments that youve defined your parameters above.
This is what the received email looks like.

As you can see, theres no indication that it comes from an automated script. Instead, it has a personal message and the necessary
data/information files attached to the email. So long as you make sure the files are updated before this email goes out, youll never have to
worry about forgetting to send out another one of these status updates again. You can look as though youre being extremely productive.
Meanwhile, you can work on Saikats approach to being a procrastination ninja (!
Have you ever used the command-line SendEmail tool for Windows? Or maybe you have a different method for sending out automated
emails? Share your own insight about this tool or other similar tools in the comments section below.

Image Credit: Tory Byrne (






Mail (mailto:?body= Automated Emails Using SendEmail & Windows Task Scheduler)