使用兑换作为其他用户发送
当我查看 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 = "[email protected]";
reply.Send();
session.Logoff();
}
邮件发送正常,但已发送来自我的地址,而不是来自 [email protected]
我使用:
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 = "[email protected]";
reply.Send();
session.Logoff();
}
如果 出现异常,提示邮件配置文件未配置
那么如何使用兑换来回复邮件并控制发送地址?
提前非常感谢...
When I view outlook I see my mailbox but also additional "business function" mailboxes. One of these is "optingout"
I've written a console app that loops through several of these function mailboxes (by enumerating the folders in my session) and grabs all of the mails so I can then loop through them and take actions depending on the mailbox, subject and body.
In one case I need to reply to an email to say that they have asked to unsubscribe but I can't find the email they've used (or supplied in the body) in our database and can they respond with the correct mail... this tends to be where people have mail forwarding and have forgotten (and we get a ridiculous amount of these!)
In the below code OutlookItem is a custom class not a redemption or outlook class
When I used:
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 = "[email protected]";
reply.Send();
session.Logoff();
}
the mail sends fine but is sent from my address and not from [email protected]
if I use:
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 = "[email protected]";
reply.Send();
session.Logoff();
}
It throws an exception saying that the mail profile isn't configured
So how do I use redemption to reply to a message and control the sending address?
Many thanks in advance...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
与消息发送者相对应的
RDOMail
属性称为SentOnBehalfOf*
。如果可以,请通过 EntryID(即SentOnBehalfOfEntryID
)进行设置,或通过将相应的RDOAddressEntry
对象直接分配给SentOnBehalfOf
属性来设置。仅设置SentOnBehalfOfName
属性会带来名称歧义的风险。设置此选项要求您用于登录 Exchange 存储的帐户对应代表发送邮件的地址簿条目具有“发送为”权限。
The
RDOMail
-properties corresponding to the sender of a message are calledSentOnBehalfOf*
. If you can, set it by EntryID (i.e.SentOnBehalfOfEntryID
) or by assigning the correspondingRDOAddressEntry
object directly to theSentOnBehalfOf
-property. Setting only theSentOnBehalfOfName
-property runs the risk of name ambiguity.Setting this requires that the account you use to log on to the Exchange store has "Send As" permissions for the adressbook entry that the message should be sent on behalf of.