十一Windows PowerShell发送电子邮件

时间:2020-03-21 11:49:44  来源:igfitidea点击:

有时需要在没有安装任何其他东西的情况下从Windows计算机测试SMTP配置。

在Windows PowerShell 2.0上进行了测试:

PS> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- -------
2     0     -1    -1

发送电子邮件:

PS> Send-MailMessage -SmtpServer mail.example.com -Credential sandy -To Hyman@theitroad -From Hyman@theitroad -Subject "Test" -Body "Hello"

Windows PowerShell凭据请求弹出窗口将出现,我们必须其中键入sandy的密码。