powershell - Windows 10 的 powershell 中的电子邮件功能操作已超时
问题描述
我在运行我的 powershell 脚本时收到“Send-MailMessage:操作已超时”操作。下面是我得到的例外
Send-MailMessage : The operation has timed out.
At C:\Users\f1ym41a\Documents\email.ps1:8 char:1
+ Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject -Body $Body -Smtp ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], SmtpExcept
ion
+ FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage
我正在使用的代码或我的 powershell 脚本
$From = "user@domain.com"
$To = "user@domain.com"
$Cc = "user@domain.com"
$Subject = "Here's the Email Subject"
$Body = "This is what I want to say"
$SMTPServer = "someserver"
$SMTPPort = "25"
Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject -Body $Body -SmtpServer $SMTPServer -port $SMTPPort –DeliveryNotificationOption OnSuccess
谁能帮我解决为什么我会出现超时异常?
解决方案
推荐阅读
- ios - 在 iOS 中更改 MDCActivityIndicator 轨道颜色
- arrays - Excel 公式:数组中的计数条件
- string - 打印、放置、说和转义字符
- angular - circleci 上的 ng e2e - 服务器提前终止,状态为 127
- appium - 运行 Appium-doctor 时收到警告
- java - 无法使用 dagger2 android java 注入 ViewModel
- amazon-web-services - 使用从属实例在 aws 之外访问 AWS elasticache?
- html - 使引导页脚贴在内容的底部
- cookies - Cookie 随机地来来去去,它们不会从一个选项卡到下一个选项卡或跨浏览器重新启动持续存在
- qt - 如何在 qml 中仅在必要时显示 ScrollBar?