华域联盟 PowerShell PowerShell小技巧之使用Hotmail账号发送邮件

PowerShell小技巧之使用Hotmail账号发送邮件

在低版本的PowerShell上发送邮件可以借助.NET的system.net.mail.smtpclient类。在高版本的PowerShell中可以借助现成的命令:Send-MailMessage

我在尝试使用Hotmail时,遇到了一个错误:

Send-MailMessage : The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a 
STARTTLS command first

后来发现是没有指定端口号,应当使用:587端口号。

Send-MailMessage -Body 'test' -SmtpServer smtp.live.com -From [email protected] -To '[email protected]' -Subject 'test' -UseSsl -Credential [email protected] -Port 587

常规错误排查:

邮箱是否开启SMTP服务
账号和密码是否输入正确
端口号是否正确

您可能感兴趣的文章:

本文由 华域联盟 原创撰写:华域联盟 » PowerShell小技巧之使用Hotmail账号发送邮件

转载请保留出处和原文链接:https://www.cnhackhy.com/14451.htm

本文来自网络,不代表华域联盟立场,转载请注明出处。

作者: sterben

发表回复

联系我们

联系我们

2551209778

在线咨询: QQ交谈

邮箱: [email protected]

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部