【发布时间】:2020-12-22 15:28:53
【问题描述】:
我使用以下 PowerShell 脚本使用 Azure SendGrid 帐户详细信息发送电子邮件。执行脚本时,我收到错误 Send-MailMessage : Unable to read data from the transport connection: net_io_connectionclosed
PoweShell 脚本:
$Username ="xxxxx@azure.com"
$Password = ConvertTo-SecureString "xxxx" -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential $Username, $Password
$SMTPServer = "smtp.sendgrid.net"
$EmailFrom = "from@mail.com"
$EmailTo = "to@mail.com"
$Subject = "SendGrid test"
$Body = "SendGrid testing successful"
Send-MailMessage -smtpServer $SMTPServer -Credential $credential -Usessl -Port 587 -from $EmailFrom -to $EmailTo -subject $Subject -Body $Body
那么,谁能建议我如何解决这个问题。
【问题讨论】:
标签: azure smtp sendgrid azure-powershell