【问题标题】:Sending mail through SmtpClient and smtp.office365.com setting email's sensitivity to normal, personal, private or confidential [duplicate]通过 SmtpClient 和 smtp.office365.com 发送邮件,设置电子邮件对普通、个人、私人或机密的敏感度 [重复]
【发布时间】:2021-11-11 10:50:58
【问题描述】:

我在编写的程序中使用System.Net.Mail 向多个地址发送电子邮件。他们中的一些人使用 HCL Note,他们无法打开通过我的工具发送的电子邮件。同时,我发现这些电子邮件是以“私人”敏感度发送的(例如在 Outlook 中:https://support.content.office.net/en-us/media/e4eef27b-95d6-4c7e-a449-c47e6454750d.png)。

我的问题是是否有可能将邮件设置为“正常”敏感度?

我使用以下代码(摘要):

    var message = new MailMessage();
    message.To.Add(TOadressee.ToString());
    message.CC.Add(CCadressee.ToString());
    message.From = new MailAddress("claims@l-und-b.de", String.Empty, System.Text.Encoding.UTF8);
    message.Subject = "Subject line";
    message.BodyEncoding = System.Text.Encoding.UTF8;
    message.Body = "messagetext";
    message.IsBodyHtml = true;

    var client = new SmtpClient("smtp.office365.com", 587);
    client.EnableSsl = true;
    client.Credentials = new                    

    System.Net.NetworkCredential(senderaddress, password);
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
    client.Send(message);

我不知道去哪里找。希望你们中的一些人能给我一些意见。

或者是否有其他支持 smtp 和敏感功能的免费邮件包可用?

【问题讨论】:

标签: c# system.net.mail


【解决方案1】:

因此,敏感度是邮件项的标题属性。电子邮件客户端带有一些自己的标准,不一定会传输到 .Net 邮件项目中的属性。

但是,MailMessage 类将允许您访问标头并在其中添加任何内容(类似于 htpp 请求/响应标头 - 作为键/值对的集合)。

您必须将这些标准与公认的标准相匹配,通常记录在 RFCXXX 上(对于 RFC1327 就是这种情况,它为“敏感度”子句设置标题,作为 RFC822 模型。

所以你可以像这样使用:message.Headers.Add("Sensitivity", "Company-Confidential")

【讨论】:

  • 这正是我想要的。完美运行。非常感谢!周末愉快!
  • 好的,你也是——很高兴它有效
猜你喜欢
  • 2022-11-08
  • 1970-01-01
  • 2016-03-10
  • 1970-01-01
  • 2016-07-27
  • 1970-01-01
  • 2015-10-09
  • 1970-01-01
  • 2017-01-10
相关资源
最近更新 更多