尝试从Azure发送电子邮件。
$Credential = Get-AutomationPSCredential -Name 'email@contoso.com'
$Username = $Credential.Username
$Password = $Credential.GetNetworkCredential().Password
[securestring]$SecurePassword = ConvertTo-SecureString $Password -AsPlainText -Force
[pscredential]$PSCredential = New-Object System.Management.Automation.PSCredential ($Username, $SecurePassword)
$Username
$Password
但是,我收到此错误。曾经尝试过使用Google,但找不到真正的解决方案或解释。也许你们中的一些人已经和这个亲密了?
我们遇到的错误是:
Send-MailMessage : The SMTP server requires a secure connection or the client was not authenticated. The server
response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM
[AM7PR03CA0008.eurprd03.prod.outlook.com]
At line:26 char:1
+ Send-MailMessage @mailParams
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage],
SmtpException
+ FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage
非常感谢您。