none
Open outlook email RRS feed

  • Question

  • I have a routine that generates an email content and it sends it.... but I will like to see the content of the email before I send it... is there a way I could open outlook before I send the email?

    thanks


    michael john ocasio

    • Moved by Bill_Stewart Friday, July 29, 2016 3:37 PM Move to more appropriate forum
    Friday, July 29, 2016 12:08 PM

Answers

  • Hi mjchael,

    >> I see  I am creating an instance of Net.Mail.MailMessage

    It seems you send email by Net.Mail.MailMessage. If so, as the suggestion from jrv, you could not open the file directly in Outlook.

    The message file type of Net.Mail.MailMessage is eml, and message file type of Outlook is msg. If you want to display it in Outlook, you will need to convert the eml file to msg file, and then open it from Outlook. There is no built-in function to convert them in Outlook Object Model. The link below might be useful to you.

    # Converting EML's to MSG's
    http://stackoverflow.com/questions/29493393/converting-emls-to-msgs

    In my option, if you will display it in Outlook, I suggest you create email directly in Outlook which is much easy and convenient. You could try like:

         using outlook = Microsoft.Office.Interop.Outlook;
                outlook.Application oApp = new outlook.Application();
                outlook._MailItem oMailItem = (outlook._MailItem)oApp.CreateItem(outlook.OlItemType.olMailItem);
                oMailItem.To = "vv@hotmail.com";
                oMailItem.Subject = "Test";
                // body, bcc etc...
                oMailItem.Display(true);

    In addition, Outlook Automation is not recommended and supported in asp.net Project.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, August 1, 2016 5:30 AM

All replies

  • If you are not sending it from Outlook then how could you view it in Outlook? 


    \_(ツ)_/

    Friday, July 29, 2016 12:38 PM
  • Yes my intention is to send it from outlook..... but will like to give the opportunity to the user to read the content before send it if there is a need to change the body content of the email.... or other segment of the email.

    thanks


    michael john ocasio

    Friday, July 29, 2016 3:02 PM
  • How are you creating the email message?  Why can't you display it in Outlook.  Are you sure you are creating it in Outlook?

    \_(ツ)_/

    Friday, July 29, 2016 4:04 PM
  • Hello Michael,

    What code do you use for sending emails?

    In case if Outlook is automated for getting the job done, the MailItem class provides the Display method which displays a new Inspector object for the item.

    You may find the C# app automates Outlook (CSAutomateOutlook) sample project helpful.


    [custom.development]

    • Proposed as answer by jrv Friday, July 29, 2016 6:01 PM
    Friday, July 29, 2016 6:00 PM
  • I should also note that if you are using Send-MailMessage or CDO from VBScript or the .NET Message class then the message will not be available in Outlook.


    \_(ツ)_/

    Friday, July 29, 2016 6:09 PM
  • I did try the inspector Display but it error out....

    michael john ocasio

    Friday, July 29, 2016 8:10 PM
  • I see  I am creating an instance of Net.Mail.MailMessage

    michael john ocasio

    Friday, July 29, 2016 8:12 PM
  • Hi mjchael,

    >> I see  I am creating an instance of Net.Mail.MailMessage

    It seems you send email by Net.Mail.MailMessage. If so, as the suggestion from jrv, you could not open the file directly in Outlook.

    The message file type of Net.Mail.MailMessage is eml, and message file type of Outlook is msg. If you want to display it in Outlook, you will need to convert the eml file to msg file, and then open it from Outlook. There is no built-in function to convert them in Outlook Object Model. The link below might be useful to you.

    # Converting EML's to MSG's
    http://stackoverflow.com/questions/29493393/converting-emls-to-msgs

    In my option, if you will display it in Outlook, I suggest you create email directly in Outlook which is much easy and convenient. You could try like:

         using outlook = Microsoft.Office.Interop.Outlook;
                outlook.Application oApp = new outlook.Application();
                outlook._MailItem oMailItem = (outlook._MailItem)oApp.CreateItem(outlook.OlItemType.olMailItem);
                oMailItem.To = "vv@hotmail.com";
                oMailItem.Subject = "Test";
                // body, bcc etc...
                oMailItem.Display(true);

    In addition, Outlook Automation is not recommended and supported in asp.net Project.

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Monday, August 1, 2016 5:30 AM