本文介绍了Powershell电子邮件:如何发送具有高度重要性的电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 Powershell
发送具有高重要性的电子邮件。但是,当邮件进入收件箱时,它不会标记为高重要性。
I am trying to send an email with High Importance using Powershell
. But when mail comes to inbox it does not mark with High Importance.
以下是电子邮件脚本:
$EmailFrom = "[email protected]"
$EmailTo = "[email protected]"
$Subject = "Disk Space Low: $server"
$Body = "Server Name: $server, <NEED NEW LINE> Drive: C, <NEED NEW LINE> Total Size: $sizeGB, <NEED NEW LINE> Space Left: $freeSpaceGB"
$SMTPServer = "scan.opinergo.fn"
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 25)
#$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("<From mail ID>", "Password");
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
对于高重要性,我添加了以下内容,但当邮件进入Outlook时,它们都不起作用:
For High Importance i have added following but none is working when mail comes to outlook:
1) $ EmailPriority = [System.Net.Mail。 MailPriority] :: High
邮件来了,但不重要
2) $ Priority = [System.Net.Mail.MailPriority] ::高
邮件来了,但不重要
3) $ Priority = high
邮件来了但不重要
4) $ EmailPriority = high
邮件来了,但并不重要
推荐答案
此代码将发送优先级高的电子邮件:
This code would send out a high priority email:
$smtp = new-object Net.Mail.SmtpClient("yourDomain.com")
$email = New-Object System.Net.Mail.MailMessage
$email.From = "[email protected]"
$email.To.Add("[email protected]")
$email.Subject = "Enter your Email Subject"
$email.Body = "Enter the body of your email"
$email.Priority = [System.Net.Mail.MailPriority]::High
$smtp.Send($email)
这篇关于Powershell电子邮件:如何发送具有高度重要性的电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!