Open an Outlook Mail Message from Windows Form  
Author Message
ekb0211





PostPosted: Visual C# General, Open an Outlook Mail Message from Windows Form Top

I have created a reference in my project to Microsoft.Office.Interop.Outlook, so that I can create outlook mail messages, and, simple as it sounds, I just cannot figure out how to open (in outlook) the mail message that I've created. Here is the code that I use to create the message...

Microsoft.Office.Interop.Outlook.Application outLookApp
= new Microsoft.Office.Interop.Outlook.Application();

// Create the mail message
Microsoft.Office.Interop.Outlook.MailItem mailItem
= (MailItem)outLookApp.CreateItem(OlItemType.olMailItem);
mailItem.Subject = "some subject goes here";
mailItem.BodyFormat = OlBodyFormat.olFormatHTML;
mailItem.Body = "email body goes here";

After I create the message with the body and subject filled out, I want to be able to open the message in outlook so that the user can select from their addressbook who to send it to, add anything they need to add, and then send the email from outlook. Any help or direction would be appreciated. Thanks!




Visual C#5  
 
 
maguidhir





PostPosted: Visual C# General, Open an Outlook Mail Message from Windows Form Top

Nevermind, I found that i can do this which is much simpler:



I can leave the email address part blank so that it brings up an email with the subject and body filled in, but the "To" field blank - so the user can enter that themselves.


 
 
maguidhir





PostPosted: Visual C# General, Open an Outlook Mail Message from Windows Form Top

would anyone have any idea how I would apply any sort of formatting to the email body while using this method When the email opens it says the format is HTML, but the html tags show up in the email if I enter html in the body portion of the mailto parameter. I've also tried line breaks and they show up as the \r\n instead of the actual line break itself.