Forum Discussion

Mohitur's avatar
Mohitur
Copper Contributor
Mar 13, 2024

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

Resources