SentOnBehalfOfName 的问题 [英] Issue with SentOnBehalfOfName

查看:22
本文介绍了SentOnBehalfOfName 的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了Outlook 问题,我想更改电子邮件发件人.我想用一个发件人发送来自 Outlook 的所有电子邮件.当我从 Outlook 更改发件人时它工作正常但是当我从 Outlook plugin 更改它时它不起作用.我正在使用以下代码:

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆