locked
Created app who send email in outlook 2016 but not in outlook 2013. Getting error when try to send in outlook 2013 RRS feed

  • Question

  • Hi there,

    I have an program what is sending email to clients such as invoice in PDF. I have created the program in outlook 2016, but a client of my have outlook 2013. There is an error

    Outlook error

    The code i have written:

    using Microsoft.Office.Interop.Outlook;
    using Exception = Microsoft.Office.Interop.Outlook.Exception;
    using OutlookApp = Microsoft.Office.Interop.Outlook.Application;
    
    OutlookApp outlookApp = new OutlookApp();
    
                    MailItem mailItem = outlookApp.CreateItem(OlItemType.olMailItem);
                    mailItem.Subject = subject + " " + HovenierStart.bedrijfsNaam;
                    mailItem.HTMLBody = body;
                    mailItem.To = email;
    
    
    
    
                    mailItem.Attachments.Add(fileNaam);
                    //Set a high priority to the message
                    mailItem.Importance = OlImportance.olImportanceHigh;
                    mailItem.Display(true);

    In the init i put:

    Type officeType = Type.GetTypeFromProgID("Outlook.Application");

    Past the test but failed.

    Hoping for a solution

    Rinaldo


    Greetings from Amsterdam the Netherlands

    Tuesday, December 4, 2018 5:16 PM

All replies

  • Hi Rinaldo1961,

    Thank you for posting here.

    Since this thread is more related to outlook, please post it in the following forum.

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=outlookdev&filter=alltypes&sort=lastpostdesc

    The Visual C# forum discuss and ask questions about the C# programming language, IDE, libraries, samples, and tools.

    Best regards,

    Jack J Jun.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, December 12, 2018 6:25 AM