【发布时间】:2011-01-16 02:34:02
【问题描述】:
当我查看 Outlook 时,我会看到我的邮箱,但还会看到其他“业务功能”邮箱。其中之一是“选择退出”
我编写了一个控制台应用程序,它循环遍历其中几个函数邮箱(通过枚举会话中的文件夹)并抓取所有邮件,这样我就可以遍历它们并根据邮箱、主题和身体。
在一种情况下,我需要回复一封电子邮件,说明他们已要求退订,但我在我们的数据库中找不到他们使用(或在正文中提供)的电子邮件,他们能否回复正确邮件......这往往是人们进行邮件转发并忘记的地方(我们收到的这些邮件数量非常可笑!)
在下面的代码中,OutlookItem 是一个自定义类,而不是兑换或 Outlook 类
当我使用时:
private void replyToMail(OutlookItem item)
{
RDOSession session = new RDOSession();
session.Logon(null, null, null, true, null, null);
RDOMail thisItem = session.GetMessageFromID(item.EntryID, item.StoreID, null);
RDOMail reply = thisItem.Reply();
reply.Subject = "Automated Response - Could not complete unsubscribe";
reply.Body = "This is an automated response ...";
reply.BCC = "test@our-domain.co.uk";
reply.Send();
session.Logoff();
}
邮件发送正常,但从我的地址发送,而不是从 optingout@our-domain.co.uk
如果我使用:
private void replyToMail(OutlookItem item)
{
RDOSessionClass session = new RDOSessionClass();
session.LogonExchangeMailbox("optingout", "big.ol.mailserver");
RDOMail thisItem = session.GetMessageFromID(item.EntryID, item.StoreID, null);
RDOMail reply = thisItem.Reply();
reply.Subject = "Automated Response - Could not complete unsubscribe";
reply.Body = "This is an automated response ...";
reply.BCC = "test@our-domain.co.uk";
reply.Send();
session.Logoff();
}
它抛出一个异常,说明邮件配置文件未配置
那么如何使用兑换来回复消息并控制发送地址?
提前非常感谢...
【问题讨论】:
标签: send exchange-server-2007 outlook-redemption send-on-behalf-of