Sunday 3 August 2014

Creating New Outlook mail Item Using C#


using Microsoft.Office.Interop.Outlook;
using OutlookApp = Microsoft.Office.Interop.Outlook.Application;

-----------------------------------------------------------------------------


               OutlookApp outlookApp1 = new OutlookApp();
                MailItem _mi =(MailItem) outlookApp1.CreateItem(OlItemType.olMailItem);
                _mi.Subject = "This is the subject";
                _mi.To = "someone@example.com";
                _mi.Body = "This is the message.";
                _mi.Attachments.Add(@"C:/Users/Manjunath.le/Downloads/Annexure.pdf");
                _mi.Display(false);


// This will open New Outlook mail Create Window.

No comments:

Post a Comment