转发的MailItem展望Addinn问题 [英] forwarding MailItem Outlook Addinn issue
问题描述
我想获得一个点击按钮被选中的邮件项目,然后我必须把它转发给一些固定的电子邮件地址,即时通讯到C#语言很新,这是一个即时通讯与我的MailItem使用转发功能
i am trying to get the selected mail item on the click of a button and then i have to forward it to some fixed email adress ,i m very new to c# language,this is the function which i m using with my mailitem to forward
private void sendMail(MailItem mail)
{
mail.to = "myemailid@gmail.com"; //my fixed email adress
mail.cc=""; //removing any carboncopy users
mail.bcc=""; //removing any blind carbon copy users
mail.send();
}
这是工作正常,但发生的事情是我转发的电子邮件是在我的发件箱一起:myemailid @ gmail.com,但它会从我的收件箱中删除。我认为这可能是由于使用邮件项目IM的同一个实例,所以我尝试使用此代码
this is working correctly but what happens is as i forward the email it is in my sentbox with to:myemailid@gmail.com,but it gets deleted from my inbox. i thought that it might be due the same instance of mail item i m using,so i tried using this code
private void sendMail(MailItem mail)
{MailItem newmail = mail;
newmail.to = "myemailid@gmail.com"; //my fixed email adress
newmail.cc=""; //removing any carboncopy users
newmail.bcc=""; //removing any blind carbon copy users
//++ some code for coping the attachments ++
newmail.send();
}
而这也是造成同一situation..it被转发,但被删除从我的收件箱
but this is also resulting in same situation..it gets forwarded but gets deleted from my inbox
推荐答案
我得到了我的答案,无论如何,如果有人其他需要这个可以使用这个: - )
I got my answer,anyway if someone other need this can use this :-)
private void sendMail(MailItem mail)
{MailItem newmail = Application.CreateItem(Outlook.OlItemType.olMailItem) as Outlook.MailItem;
newmail = mail.Forward();
newmail.Recipients.Add("myemailid@gmail.com");
newmail.Send();
}
这篇关于转发的MailItem展望Addinn问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!