如何通过功能区按钮发送电子邮件 [英] How to send email by ribbon button

查看:160
本文介绍了如何通过功能区按钮发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我尝试通过自定义功能区按钮发送电子邮件 

i trying to send email by custom Ribbon Button 

请告诉我如何通过此按钮发送电子邮件,并在功能区按钮中获取邮件正文

so plese tell me how to get send email by this button and  get body  of mail in in Ribbon button

谢谢

Dharmesh Sharma info@dharmeshsharma.com www.dharmeshsharma.com

Dharmesh Sharma info@dharmeshsharma.com www.dharmeshsharma.com

推荐答案

嗨Dharmesh,

Hi Dharmesh,

首先,获取EmailItem和获取电子邮件。您可以使用以下代码片段来获取所选邮件正文:

Fistly, get EmailItem and get body of email. you can use the below code snippets to get selected mail body:

private string body()
{ 
    Outlook.Application myApplication =        Globals.ThisAddIn.Application;
    Outlook.Explorer myActiveExplorer = (Outlook.Explorer)myApplication.ActiveExplorer();

     Outlook.Selection selection = myActiveExplorer.Selection;

     if (selection.Count == 1 && selection[1] is Outlook.MailItem)
     {
          Outlook.MailItem mail = (Outlook.MailItem)selection[1];

return mail.Body;
     }
}

然后在功能区按钮的单击事件中,您可以调用 MailItem.Send()发送电子邮件的方法:

Then in the click event of Ribbon button, you can call MailItem.Send() method to send the email:

private void sendEmai_click(object sender, RibbonControlEventArgs e)
{
    mail.send()
}

谢谢。


这篇关于如何通过功能区按钮发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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