我正在尝试使用Powershell脚本生成电子邮件,但是由于遇到以下错误而无法发送电子邮件,我试图检查各种东西以进行跟踪和检查,但是我没有得到想要的结果
$emailbody = $body2
$from = "some@email.com"
$smtp = "smtp-au.domain.com"
Send-MailMessage `
-From $from `
-To "s.pap@domain.com" `
-Subject "Scheduled Jobs Report Status" `
-Priority High `
-Body "$emailbody" `
-BodyAsHtml `
-SmtpServer $smtp
答案 0 :(得分:0)
尝试以下操作也使用您的smtp服务器的IP而不是fqdn
[string] $ stmp = 0.0.0.0
[string] $ emailfrom = email@company.com
[string] $ emailtoo = email@company.com(如果您在此处添加多个电子邮件地址,请在字符串末尾添加[],例如[string []] $ emailtoo这样)