Background story (that you can safely ignore)
I have been using scheduled tasks to send myself/other people email/SMS reminder for a long time already. For example, I once used this task to send a SMS reminder to remind someone to claim her weekly Unemployment Insurance Benefit.
In the past, I only need to set the Gmail account to allow less secure app to access and the script will work wonders. Google is now stricter for allowing less secured apps. You can still configure this setting, but they will turn it off automatically after a while and will break your automation.
Now that I must use this script again, I need to first generate an App password for my device.
The Guide
- If you are using personal google account, you can go ahead and skip to step 3. For G Suite users, the administrator will need to allow users to enable 2 step Verification first.
Go to your G Suite Admin console and then Security -> Settings

- To allow 2-Step Verification, check the box to allow users to turn on 2-step Verification. It is up to you (or your organization) if you want to enforce this setting. For company, it maybe wise to enforce it to enhance security.

- Now back to the user account settings and go to Security there. Enable 2-step Verification and then click on App Passwords to set one up.

- There are two drop down menu. (at least for when this guide was written) I chose “Mail” and “Windows Computer” because I will be using a Windows system and run a scheduled task to connect and send email using PowerShell.

Once we get the Gmail/Gsuite settings out of the way, we would work on the PowerShell Script.
#Defining Variables.
$Date = Get-Date -f dd #this will get us the current date
$Month = Get-Date -f MMMM #this will get us the current month
$Year = Get-Date -f yyyy #this will get us the current year
$Today = $Month + ‘ ‘ + $date + ‘, ‘ + $year
$SMTPServer = "smtp.gmail.com"
$Port = 587
$EmailFrom = "kenny" #replace this with the email address that you have the App Password setup.
$Pwd = "password" #replace this with the actual App password that you have just setup.
$EmailTo = "kenny" #replace this with the email address or the Phone number (will explain how to send a text in a moment.) You can add multiple email here, each separate by a comma “,”
$Subject = "Reminder!” #replace the subject you want to put in the Email subject line.
$Body = "Today is $today! Remember you need to do this!" #replace the body of the email here.
$SMTPclient = New-Object Net.Mail.Smtpclient($SMTPServer, $port)
$smtpclient.enableSsl = $true
$SmtpClient.Credentials = New-Object System.Net.NetworkCredential($EmailFrom, $Pwd);
$SMTPClient.Send($From, $To, $Subject, $Body)
- On the computer that you will be running this script, open Task Scheduler and create a task. In the action tab, set Action to “Start a program” and under “Program/Script”, type in powershell. Next to “Add arguments (optional)” put in
-ExecutionPolicy -RemoteSigned -file “c:\script\reminder.ps1” -recurse
You should replace the file path with the location of your script. I will leave the rest of the config to you.
If you run the task now, you should receive an email reminder defined from the script.

To send text messages instead of an email, you will need to know the carrier the phone number is subscribed under. For example, if 123-456-7890 is under Verizon, you can put 1234567890@vtext.com in the $EmailTo section
Below is a list I found with the email Gateways for the more popular phone carriers in the U.S. I believe this list is correct. I can confirm T-Mobile, Verizon, and AT&T are correct because I have used them before.
- AT&T: number@txt.att.net (SMS), number@mms.att.net (MMS)
- T-Mobile: number@tmomail.net (SMS & MMS)
- Verizon: number@vtext.com (SMS), number@vzwpix.com (MMS)
- Sprint: number@messaging.sprintpcs.com (SMS), number@pm.sprint.com (MMS)
- Xfinity Mobile: number@vtext.com (SMS), number@mypixmessages.com (MMS)
- Virgin Mobile: number@vmobl.com (SMS), number@vmpix.com (MMS)
- Tracfone: number@mmst5.tracfone.com (MMS)
- Simple Mobile: number@smtext.com (SMS)
- Mint Mobile: number@mailmymobile.net (SMS)
- Red Pocket: number@vtext.com (SMS)
- Metro PCS: number@mymetropcs.com (SMS & MMS)
- Boost Mobile: number@sms.myboostmobile.com (SMS), number@myboostmobile.com (MMS)
- Cricket: number@sms.cricketwireless.net (SMS), number@mms.cricketwireless.net (MMS)
- Republic Wireless: number@text.republicwireless.com (SMS)
- Google Fi (Project Fi): number@msg.fi.google.com (SMS & MMS)
- U.S. Cellular: number@email.uscc.net (SMS), number@mms.uscc.net (MMS)
- Ting: number@message.ting.com
- Consumer Cellular: number@mailmymobile.net
- C-Spire: number@cspire1.com
- Page Plus: number@vtext.com