Forum Discussion
Mohitur
Mar 13, 2024Copper Contributor
sending emails from Gmail using power shell script
Hi,
I am trying to use PowerShell script to send automatic emails to the users using Gmail. however, when I am running the script, encountering the following error message
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required. For more information, go to
Below is the script I am using.
Send-Mailmessage -smtpServer $smtpServer -Port 587 -UseSsl -from $from -to $emailaddress -subject $subject -body $body -bodyasHTML -priority High -Encoding $textEncoding -Credential $credential -ErrorAction Stop
Any help will be highly appreciated.
Thank you.
4 Replies
Sort By
- Did you create an app password for Gmail? https://stackoverflow.com/questions/66044348/sending-mail-from-powershell-via-gmail-smtp