我目前正在开发一个自动处理邮箱邮件的应用程序。我们使用Outlook Redemption工具,并将一个服务帐户连接到多个Exchange邮箱。
<<p> 案例/strong>我们面临的问题是从原来的邮箱转发邮件。假设服务帐户"A"正在处理共享邮箱"B"并转发邮件。我希望发件人是'B'的邮件地址,但是当我收到邮件时,'A'的邮件地址显示为发件人。
<<p> 源代码/strong>// Initialize the session with the service account.
_session = new RDOSession();
_session.LogonExchangeMailbox(configurationSettings.MailAddress, configurationSettings.Url);
// Connect to the target mailbox and retrieve mail message.
RDOStore store = _session.Stores.GetSharedMailbox(targetMailBox);
RDOMail originalMailItem = store.GetMessageFromID(entryId);
// Creates a forwarded version of the mail.
RDOMail forwardMailItem = originalMailItem.Forward();
// Set sender to target mailbox owner.
if (store is RDOExchangeMailboxStore)
{
forwardMailItem.Sender = ((RDOExchangeMailboxStore)store).Owner;
forwardMailItem.SenderEmailAddress = targetMailBox;
}
// Set recipient and send.
forwardMailItem.Recipients.Clear();
forwardMailItem.Recipients.Add(forwardMailAddress);
forwardMailItem.Send();
- 谁有解决方案的线索?
- 如果这不起作用,是否可以在"代表"规则中获得"B"的邮件地址?
提前感谢!!
问题是要转发的消息是在配置文件中的主存储中创建的,而不是在委托邮箱中创建的。
除了设置Sender属性,你有没有尝试设置SentOnBehalfOf属性?