sending emails from Gmail using power shell script

Copper Contributor

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
no. i am using a gsuit (google workspace) account. there is no option for app password there.
I am using gsuit (Google workspace). I do not have the option of creating app password.
Could you allow a specific public IP to relay anonymously in Gsuite?