Would you like to learn how to send an email using Powershell and Gmail? In this tutorial, we are going to show you how to use Powershell to send email notifications using the command-line on a computer running Windows.
• Windows 2012 R2
• Windows 2016
• Windows 2019
• Windows 10
Equipment list
The following section presents the list of equipment used to create this tutorial.
As an Amazon Associate, I earn from qualifying purchases.
Related tutorial – PowerShell
On this page, we offer quick access to a list of tutorials related to PowerShell.
Tutorial – Gmail Integration
First, we need to enable your Gmail account to receive connections from external programs.
Open your browser and access your Gmail account.
In our example, the following URL was entered in the Browser:
On the login screen, enter your Gmail username and password.
After the login, you need to access the following URL:
• https://myaccount.google.com/signinoptions/two-step-verification
Enable the two step verification on this account.
After enabling the two step verification, you need to access the following URL:
• https://security.google.com/settings/security/apppasswords
Create an application password.
Select the Gmail application and the type of device: Other.
In our example, we named the device POWERSHELL.
Click on the Generate button and take note of the randomly generated password.
Next, you need to access the following URL:
• https://accounts.google.com/DisplayUnlockCaptcha
Click on the Continue button to enable external access to your Google account.
You have finished the required steps for the Gmail integration.
The Gmail integration will solve the following error.
It will also solve this error.
You have finished the Gmail integration.
Tutorial Powershell – Send email using Gmail
Use the Powershell command-line to send an email using Gmail.
Enter the Gmail account credentials.
If the test was successful, you will receive the sent message.
Send the email with an attachment using Powershell.
Use Powershell to send an email using Gmail and a stored credential.
Use Powershell to send an email using Gmail and a credential.
Congratulations! You are able to use PowerShell to send emails using Gmail.