如何设置“高重要性”使用 VBA 发送电子邮件?
我尝试在此对象上设置一些属性来发送具有高重要性的电子邮件,但似乎没有任何效果。这是我尝试过的:
objEmail.Importance = 2
objEmail.Configuration.Fields.Item("urn:schemas:mailheader:X-MSMail-Priority") = "High" ' For Outlook 2003
objEmail.Configuration.Fields.Item("urn:schemas:mailheader:X-Priority") = 2 ' For Outlook 2003 also
objEmail.Configuration.Fields.Item("urn:schemas:httpmail:importance") = 2
Function Send(sTo As String, sFrom As String, sSubject As String)
Set objEmail = CreateObject("CDO.Message")
objEmail.From = sFrom
objEmail.To = sTo
objEmail.Subject = sSubject
objEmail.Textbody = emailBody
objEmail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "my.smtp.server"
objEmail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
// is there a property for high importance, outlook 2007?
objEmail.Configuration.Fields.Update
objEmail.Send
End Function
I tried setting a few properties on this object to send an email with high importance, but nothing seemed to work. Here is what I tried:
objEmail.Importance = 2
objEmail.Configuration.Fields.Item("urn:schemas:mailheader:X-MSMail-Priority") = "High" ' For Outlook 2003
objEmail.Configuration.Fields.Item("urn:schemas:mailheader:X-Priority") = 2 ' For Outlook 2003 also
objEmail.Configuration.Fields.Item("urn:schemas:httpmail:importance") = 2
Function Send(sTo As String, sFrom As String, sSubject As String)
Set objEmail = CreateObject("CDO.Message")
objEmail.From = sFrom
objEmail.To = sTo
objEmail.Subject = sSubject
objEmail.Textbody = emailBody
objEmail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "my.smtp.server"
objEmail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
// is there a property for high importance, outlook 2007?
objEmail.Configuration.Fields.Update
objEmail.Send
End Function
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
自从我使用 Outlook 和 VBA 以来已经有一段时间了,但我仍然有各种备忘单和链接。我把这个挖出来了;希望有帮助!
尝试在邮件对象中设置 .Importance 属性
It's been a while since I worked with Outlook and VBA but I still have various cheat sheets and links. I dug this up; hope it helps!
Try setting the .Importance property in your mail object
.重要性 = 2(对于 2015 年关注的人)。
.Importance = 2 (for anyone looking in 2015).
来自 Remou 的链接 在评论中,这适用于通过 VBA 的 Outlook 2010:
From Remou's link in the comments, this works for Outlook 2010 via VBA: