如何设置“高重要性”使用 VBA 发送电子邮件?

发布于 2024-09-11 00:09:42 字数 1024 浏览 9 评论 0原文

我尝试在此对象上设置一些属性来发送具有高重要性的电子邮件,但似乎没有任何效果。这是我尝试过的:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

老娘不死你永远是小三 2024-09-18 00:09:42

自从我使用 Outlook 和 VBA 以来已经有一段时间了,但我仍然有各种备忘单和链接。我把这个挖出来了;希望有帮助!

尝试在邮件对象中设置 .Importance 属性

with myEmail
    'can be olImportanceNormal, olImportanceHigh or olImportanceLow
    .Importance = olImportanceNormal
    .Subject = "Subject line"
    .Body = "Body Content"
end with

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

with myEmail
    'can be olImportanceNormal, olImportanceHigh or olImportanceLow
    .Importance = olImportanceNormal
    .Subject = "Subject line"
    .Body = "Body Content"
end with
无远思近则忧 2024-09-18 00:09:42

.重要性 = 2(对于 2015 年关注的人)。

.Importance = 2 (for anyone looking in 2015).

墨洒年华 2024-09-18 00:09:42

来自 Remou 的链接 在评论中,这适用于通过 VBA 的 Outlook 2010:

cdoMessage.Fields.Item(cdoImportance) = cdoHigh  

From Remou's link in the comments, this works for Outlook 2010 via VBA:

cdoMessage.Fields.Item(cdoImportance) = cdoHigh  
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文