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服务
账号和密码是否输入正确
端口号是否正确
相关推荐
huha 2020-10-16
lianshaohua 2020-09-23
higheels 2020-08-03
ZoctopusD 2020-08-03
酷云的csdn 2020-08-03
higheels 2020-07-27
liushun 2020-06-28
zhendeshifeng 2020-06-22
Sabrina 2020-06-11
CARBON 2020-06-03
CARBON 2020-06-01
DBATips 2020-05-31
higheels 2020-05-29
applecarelte 2020-04-15
Yyqingmofeige 2020-03-28
yoshubom 2020-03-06
Yyqingmofeige 2020-03-02
SciRui 2020-02-26