我可以将电子邮件标记为“高重要性”吗?对于使用 System.Net.Mail 的 Outlook?

发布于 2024-08-29 17:22:47 字数 451 浏览 10 评论 0原文

我正在为客户开发的应用程序的一部分涉及发送活动电子邮件。有时这些非常重要。我的客户以及我客户的大多数客户都使用 Outlook,它能够将邮件消息标记为“高重要性”。

现在,我知道假设所有最终用户都将使用相同的界面是无情的,但我不是。但考虑到即使目标不一定通过 Outlook 阅读,您也可以从 Outlook 发送电子邮件,这意味着基本上存储了一些数据,以某种方式让 Outlook 知道特定邮件是否被指定为高重要性。至少这是我的解释。

该应用程序当前使用 System.Net.Mail 发送电子邮件,使用 System.Net.Mail.MailMessages 编写电子邮件,并使用 System.Net.Mail.SmtpClient发送它们。是否可以使用 System.Net.Mail 的功能来设置此“高重要性”设置?如果没有,是否有任何可用的程序集可以配置此设置?

Part of the application I'm working on for my client involves sending emails for events. Sometimes these are highly important. My client, and most of my client's clients, use Outlook, which has the ability to mark a mail message as High Importance.

Now, I know it is callous to assume that all end users will be using the same interface, sp I am not. But considering you can send email from Outlook as High Importance even if the target is not necessarily reading through Outlook, that means that there is basically some data stored, somehow, that lets Outlook know if a particular message was assigned as High Importance. That's my interpretation, at least.

The application currently uses System.Net.Mail to send out emails, using System.Net.Mail.MailMessages for writing them and System.Net.Mail.SmtpClient to send them. Is it possible to set this "High Importance" setting with System.Net.Mail's abilities? If not, is there any assembly available which can configure this setting?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(5

冰火雁神 2024-09-05 17:22:47

设置邮件消息的优先级属性。其值为“正常”、“低”或“高”。

正如 @StefanSteiger 指出的,优先级仅保证适用于 Outlook。自此问题/答案发布以来的 8 年里,业界已将“重要性”标题作为实现此目的的首选方式。

MailMessage 的来源明确指出设置优先级实际上设置了三件事:XPriority 标头、优先级标头、和重要性标头。因此,使用 Priority 属性将在任何邮件客户端中按预期运行,并将设置适当的标头。

Set the Priority property of the mail message. Its values are Normal, Low or High.

As @StefanSteiger notes, Priority is only guaranteed to work for Outlook. In the intervening 8 years since this question/answer were posted, the industry has settled on the Importance header as the preferred way to do this.

The source for MailMessage makes it clear that setting the Priority actually sets three things: the XPriority header, the Priority header, and the Importance header. So using the Priority property will behave as expected in any mail client, and will set the appropriate headers.

自在安然 2024-09-05 17:22:47

您可以设置 System.Net.Mail.MailPriority 设置。

例如,MailPriority.High

You can set the System.Net.Mail.MailPriority setting.

MailPriority.High for example.

闻呓 2024-09-05 17:22:47

使用这个 - 它对我有用。

Dim mail As New MailMessage()
mail = New MailMessage()
mail.Priority = MailPriority.High
mail.Priority = MailPriority.Normal
mail.Priority = MailPriority.Low

Use this - it works for me.

Dim mail As New MailMessage()
mail = New MailMessage()
mail.Priority = MailPriority.High
mail.Priority = MailPriority.Normal
mail.Priority = MailPriority.Low
差↓一点笑了 2024-09-05 17:22:47

正因为 Outlook 重视优先级,
这并不意味着所有其他电子邮件程序也这样做。

优先级和重要性不是同一回事。

正确答案是:

mail.Headers.Add("Importance", "High"); // High, normal, or low

值不区分大小写。

https://www.iana.org/assignments/message-headers/ message-headers.xhtml
https://www.rfc-editor.org/rfc/rfc4021#page- 32

Just because Outlook treats priority as importance,
that doesn't mean all other email programs do so as well.

Priority and importance are NOT the same thing.

The correct answer is:

mail.Headers.Add("Importance", "High"); // High, normal, or low

values are case insensitive.

https://www.iana.org/assignments/message-headers/message-headers.xhtml
https://www.rfc-editor.org/rfc/rfc4021#page-32

浅笑轻吟梦一曲 2024-09-05 17:22:47

来晚了!优先级和重要性并不相同,但大多数开发人员都可以设置。你如何选择?嗯,优先级在 RFC 4021, 2.1.54 中定义为影响传输速度和交付的属性(“正常”、“紧急”和“非紧急”)。重要性在 RFC 4021, 2.1.52 中定义为一个属性,它是从发送者到接收者关于消息的重要性的提示(“高”、“正常”和“低”)。

对于我的用例,我以 Outlook 用户为目标并使用 MimeKit 来构建电子邮件。重要性是大多数电子邮件客户所关心的,所以我的代码可能如下所示:

using MimeKit;
var message = new MimeMessage();
message.Importance = MessageImportance.High;

我将重新发布 Steiger 的链接,因为他很准确:

Jumping in late here! Priority and Importance are not the same, but both are available to most developers to set. How do you choose? Well, Priority is defined in RFC 4021, 2.1.54, as a property that affects transmission speed and delivery ("normal", "urgent", and "non-urgent"). Importance is defined in RFC 4021, 2.1.52, as a property that is a hint from the originator to the recipients about how important a message is ("high", "normal", and "low").

For my use case, I'm targeting Outlook users and using MimeKit to build the emails. Importance is what most email clients care about, so here's what my code might look like:

using MimeKit;
var message = new MimeMessage();
message.Importance = MessageImportance.High;

I'll repost Steiger's links, because he's spot-on:

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