Отправка почты через gmail с помощью PowerShell V2 Send-MailMessage
я пытаюсь понять, как использовать PowerShell V2Send-MailMessage
с Gmail.
Вот'Это то, что я имею до сих пор.
$ss = new-object Security.SecureString
foreach ($ch in "password".ToCharArray())
{
$ss.AppendChar($ch)
}
$cred = new-object Management.Automation.PSCredential "[email protected]", $ss
Send-MailMessage -SmtpServer smtp.gmail.com -UseSsl -Credential $cred -Body...
Я получаю следующую ошибку
Send-MailMessage : The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn
more at
At foo.ps1:18 char:21
+ Send-MailMessage < `
+ CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], SmtpException
+ FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage