【发布时间】:2020-01-22 17:41:52
【问题描述】:
我曾经有过这个工作,但它不久前就停止了。该帐户的密码有效,并且我的脚本中的注释已更改。
Send-MailMessage -From ESI-NIKE@gisx.com -Subject "Server ESI-NIKE Has Rebooted" -To Glen.krinsky@xerox.com -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 "zz.gms.service@gmail.com",(Get-Content -Path zz.gms.service@gmail.com.securestring | ConvertTo-SecureString))
【问题讨论】:
-
您遇到什么错误?
-
Send-MailMessage :SMTP 服务器需要安全连接或客户端未通过身份验证。服务器响应是:5.7.0 Authentication Required
-
这能回答你的问题吗? Send-MailMessage on PowerShell does not work 看看我在那个帖子上的回答。它专门关于如何使其适用于 gmail。
-
很遗憾没有。我已经启用了不太安全的应用程序。
-
@GlenKrinsky 只是一个想法。在 From 字段中,它应该是您的 gmail 地址,而不是其他任何内容。一些邮件服务器支持在那里设置任何东西。不是 gmail。
标签: powershell email smtp