PowerShell小技巧之使用Hotmail账号发送邮件
更新时间:2014年09月15日 09:51:02 投稿:hebedich
这篇文章主要介绍了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 appana@outlook.com -To 'admin@pstips.net' -Subject 'test' -UseSsl -Credential i@outlook.com -Port 587
常规错误排查:
邮箱是否开启SMTP服务
账号和密码是否输入正确
端口号是否正确
相关文章
PowerShell使用枚举变量定义带智能提示功能的函数参数
这篇文章主要介绍了PowerShell使用枚举变量定义带智能提示功能的函数参数,但定义后只在ISE当中有效,需要的朋友可以参考下2014-07-07
最新评论