【问题标题】:Change sender on reply using EWS Managed API使用 EWS 托管 API 更改回复发件人
【发布时间】:2018-12-01 21:02:34
【问题描述】:

我目前正在尝试配置 Mail2Bug 以在新电子邮件到达共享邮箱时在 Azure DevOps 中创建错误。一切都很顺利,直到需要回复传入消息的部分。

处理这个函数的代码可以在EWSIncomingMessage.cs找到:

 public void Reply(string replyHtml, bool replyAll)
 {
     //_message is of type EmailMessage
     var reply = _message.CreateReply(replyAll);
     reply.BodyPrefix = new MessageBody(BodyType.HTML, replyHtml);
     reply.Send();
 }

回复不是使用共享邮箱的电子邮件,而是使用来自经过身份验证的用户的电子邮件。我假设这与 CreateReply 如何结合 EWS 填充回复邮件消息有关。

有没有办法解决这个问题(可能通过创建一个新的 MailMessage 并模拟回复)?

【问题讨论】:

    标签: c# .net exchangewebservices


    【解决方案1】:

    您可以参考以下代码:

    var message = (EmailMessage) Item.Bind(service, new ItemId(uniqueId), PropertySet.FirstClassProperties);
    var reply = message.CreateReply(false);
    reply.BodyPrefix = "Response text goes here";
    var replyMessage = reply.Save(WellKnownFolderName.Drafts);
    replyMessage.Attachments.AddFileAttachment("d:\\inbox\\test.pdf");
    replyMessage.Update(ConflictResolutionMode.AlwaysOverwrite);
    replyMessage.SendAndSaveCopy();
    

    更多信息,请参考以下链接:

    Replying with attachments to an email message with EWS

    How to reply to an email using the EWS Managed API?

    Respond to email messages by using EWS in Exchange

    【讨论】:

    • 谢谢@alina-li!在发送之前将邮件保存在共享邮箱的草稿文件夹中就可以了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-11-30
    • 2012-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多