您现在的位置是:网站首页> 编程资料编程资料
PowerShell小技巧之使用Hotmail账号发送邮件_PowerShell_
2023-05-26
525人已围观
简介 PowerShell小技巧之使用Hotmail账号发送邮件_PowerShell_
在低版本的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_
- Powershell小技巧之找出最大最小值_PowerShell_
- Powershell小技巧之屏蔽输出结果_PowerShell_
- Powershell小技巧之删除不规则字符_PowerShell_
- Windows Powershell 复制数组_PowerShell_
- Windows Powershell 访问数组_PowerShell_
- PowerShell小技巧之同时使用可选强制参数_PowerShell_
- PowerShell小技巧之添加远程防火墙规则_PowerShell_
- PowerShell小技巧之配置机器的静态IP_PowerShell_
- PowerShell小技巧之启动远程桌面连接_PowerShell_
