SentOnBehalfOfName问题 [英] Issue with SentOnBehalfOfName
问题描述
我与 Outlook 问题叠在一起,我想更改电子邮件发件人.我想通过一个发件人从 Outlook 发送所有电子邮件.当我从Outlook更改发件人时,它工作正常,但是当我从 Outlook 插件中更改发件人时,它不起作用.我正在使用以下代码:
i'm stack with Outlook issue where i want to change Email Sender. I want to send all emails from Outlook with one sender. When i change sender from Outlook it works fine but when i change it from Outlook plugin it's not work. I'm using following code:
private void adxOutlookEvents_ItemSend(object sender, ADXOlItemSendEventArgs e)
{
if (e.Item is MailItem)
{
MailItem mail = e.Item as MailItem;
mail.SentOnBehalfOfName = "UserName";
mail.Save();
return;
}
}
但是什么也没发生.我没有看到任何错误或异常,但电子邮件是与旧发件人一起发送到Outlook的.你能帮我吗?
But nothing happens. I don't see any error or exception but email come to Outlook with old sender. Can you please help me with that?
更新:我如何解决它.我们不能使用属性"SentOnBehalfOfName" Outlook无法正确处理它.除此之外,您应该使用发件人"属性:
UPDATED: The way how i fix it. We cant use property "SentOnBehalfOfName" Outlook handle it incorect. Except it you should use "Sender" property:
mail.Recipients.Add(mail.SentOnBehalfOfName);
mail.Recipients.ResolveAll();
var adressEntry = mail.Recipients[mail.Recipients.Count].AddressEntry;
mail.Recipients.Remove(mail.Recipients.Count);
mail.Sender = adressEntry;
推荐答案
您是通过Exchange发送并希望代表另一个用户发送(您是否具有权限?),还是试图通过特定的POP3/SMTP帐户发送? (使用MailItem.SendUsingAccount属性)?
Are you sending through Exchange and want to send on behalf of another user (do you have the permission?) or trying to send through a particular POP3/SMTP account (use MailItem.SendUsingAccount property)?
这篇关于SentOnBehalfOfName问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!