0514-86177077
9:00-17:00(工作日)
在低版本的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小技巧之設置IE代理
下一篇:PowerShell小技巧之使用New-Module命令動態創建對象
Copyright ? 1999-2012 誠信 合法 規范的巨人網絡通訊始建于2005年
蘇ICP備15040257號-8