How-To Geek

How To Easily Send Emails From The Windows Task Scheduler


The Windows Task Scheduler can automatically send email at a specific time or in response to a specific event, but its integrated email feature won’t work very well for most users.

Instead of using the Task Scheduler’s email feature to send emails, you can use the SendEmail utility. It allows you to construct a single-line command that authenticates with an SMTP server and sends an email.

The Problem With The Task Scheduler’s Email Function

When we covered setting up your computer to send you email notifications when anyone logs in, we found that the built-in email feature had some issues.

While you can enter any SMTP server you like, the Task Scheduler doesn’t support authentication, so you can’t provide a username and password for your SMTP server. The type of SMTP server most users have access to (for example, Gmail’s SMTP server, or an SMTP server provided by your Internet service provider) requires authentication, so it can’t easily be used from the Task Scheduler.

If you’re running an SMTP server on your local computer, the Task Scheduler’s email function may be useful to you. However, the average user will need another tool – that’s where SendEmail comes in.

Using SendEmail

First, download SendEmail, a free (and open source) tool for sending emails from the command line. Extract the downloaded archive into a folder on your computer.


Next, launch the Windows Task Scheduler and create a new task – consult our guide to creating scheduled tasks for more information. You can create a task that automatically sends an email at a specific time or a task that sends an email in response to a specific event.

When you reach the Action window, select Start a program instead of Send an e-mail.


In the Program/script box, use the Browse button and navigate to the SendEmail.exe file on your computer.


Finally, you’ll have to add the arguments required to authenticate with your SMTP server and construct your email. Here’s a list of the options you can use with SendEmail:

Server Options

-f EMAIL – The email address you’re sending from.

-s SERVER:PORT – The SMTP server and port it requires.

-xu USERNAME – The username you need to authenticate with the SMTP server.

-xp PASSWORD – The password you need to authenticate with the SMTP server.

-o tls=yes – Enables TLS encryption. May be necessary for some SMTP servers.

If you’re using Gmail’s SMTP servers, these are the server options you’ll need:

-s -xu -xp password -o tls=yes

Of course, you’ll have to enter your own email address and password here.

Destination Options

-t EMAIL – The destination email address. You can send an email to multiple addresses by including a space between each address after the -t option.

-cc EMAIL – Any addresses you’d like to CC on the email. You can specify multiple addresses by placing a space between each email address, just as with the -t command above.

-bcc EMAIL – The BCC version of the CC option above.

Email Options

-u SUBJECT – The subject of your email

-m BODY – The message body text of your email.

-a ATTACHMENT – The path of a file you’d like to attach. This is optional.

For example, let’s say your email address is and you’d like to send an email to You’d use the following options:

-f -t -u Subject -m This is the body text! -s -xu -xp password -o tls=yes

Once you’ve put together your options, copy and paste them into the Add arguments box.


Save your task and you’re done. Your task will automatically send email on the schedule (or in response to the event) you specified.

There’s a lot more you can do with SendEmail, including integrating it into a script that automatically sends emails or creating a shortcut that sends an email when you double-click it.

Chris Hoffman is a technology writer and all-around computer geek. He's as at home using the Linux terminal as he is digging into the Windows registry. Connect with him on Google+.

  • Published 09/22/12

Comments (3)

  1. DAB

    You can do this with Powershell as well.

  2. Roger Bertrand, P. Eng.

    Right on Buddy! And this little EXE does wonder. Works very very very well. I cannot understand how come big Blue Microsoft can’t give us tools that work to do these types of things. They put features on their OS that cannot be used because of technical restrictions: that is a bit stupid.

    Now in that train of thoughts, another stupid one is: the notification in MS OUTLOOK. What a useless thing. What is needed is some code to make sure that there is an option to send a REMINDER EMAIL along with the POPPING OUT of the NOTIFICATION, for whatever gets scheduled in OUTLOOK. I have seen COMMERCIAL SW (PERRY for example), but I will not pay a cent for things that should be right there in OUTLOOK to start with. In the meantime my palliative is a Utility SW by Karen Power Tools: EMAILERII and Countdown Timer, using both I achieve the same results, but this is a process in addition to OUTLOOK. I write an EMAIL in EMAILER II (sending it through the MAPI setup) and PROGRAM its time to send it in the COUNTDOWN utility: goes out at the required time and pops up a window telling me along with an AGENT telling me it has gone out.
    That is the kind of automation I like.

  3. Bob Grabowski

    Having a little trouble with ‘SendEmail’ I set up a test following your instructions and get an OpCode of (2), Event ID of 102 and it says the task Completed. I never get the e-mail. The Command prompt opens and closes real quick so you can’t see anything. This is my argument: -s -xu -xp Ha1zzarD# -o tls=auto -t -u Test -m Skydrive Completed
    I have also tried Ports 465 & 25. I know it
    s something simplethat I’m doing wrong, but I could use some guidance as use the Task Scheduler for my backups and would like to know when they are completed.

More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!