0

I had this working at one time, but it stopped a while ago. The password for the account is valid, and noting in my script has changed.

Send-MailMessage -From [email protected] -Subject "Server ESI-NIKE Has Rebooted" -To [email protected] -Attachments C:\1\Reboot\Previous5.txt -Body "ESI-NIKE has rebooted. Please check the Event Log if this reboot is unexpected" -SmtpServer smtp.gmail.com -Port 587 -usessl -Credential (New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "[email protected]",(Get-Content -Path [email protected] | ConvertTo-SecureString)) 
5
  • 2
    What error(s) do you get? Commented Jan 22, 2020 at 17:57
  • Send-MailMessage : The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required Commented Jan 22, 2020 at 19:07
  • Does this answer your question? Send-MailMessage on PowerShell does not work Look at my answer on that thread. It is specifically regarding how to make it work for gmail. Commented Jan 22, 2020 at 19:24
  • Unfortunately not. I already enabled less secure apps. Commented Jan 22, 2020 at 19:36
  • @GlenKrinsky Just a thought. In the From field, it should be your gmail address and not anything else. Some mail server support setting anything there. Not gmail. Commented Jan 23, 2020 at 1:45

1 Answer 1

0

Stop working for me too. for severail years I have been using PowerShell script to send emails via Gmail, rather Google G Suite, it just stopped working recently. Error is, SMTP requires a secure connection, but I am already using port 587, changed to port 465, still not working

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.