【问题标题】:Sending SMTP Mail Through Gmail Using Powershell使用 Powershell 通过 Gmail 发送 SMTP 邮件
【发布时间】: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


【解决方案1】:

也不要再为我工作了。多年来,我一直使用 PowerShell 脚本通过 Gmail 发送电子邮件,而不是 Google G Suite,它最近刚刚停止工作。错误是,SMTP 需要安全连接,但我已经在使用端口 587,更改为端口 465,仍然无法正常工作

【讨论】:

    猜你喜欢
    • 2021-05-08
    • 2017-05-12
    • 2016-04-30
    • 2014-08-27
    • 2018-11-13
    • 1970-01-01
    • 2019-05-30
    • 2016-01-16
    • 2011-08-11
    相关资源
    最近更新 更多