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.
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:
-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 smtp.gmail.com:587 -xu [email protected] -xp password -o tls=yes
Of course, you’ll have to enter your own email address and password here.
-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.
-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.
Once you’ve put together your options, copy and paste them into the Add arguments box.