1. Créer un nouveau projet
2. Ajouter la référence vers Microsoft.Office.Interop.Outlook
3. Définir sa propriété “Embed Interop Types” à “False”

Ci-dessous le code de la classe “Program”:

using Microsoft.Office.Interop.Outlook;
 
static class Program
{
    ///
    /// The main entry point for the application.
    ///
    [STAThread]
    static void Main()
    {
        MailItem mailItem =(Microsoft.Office.Interop.Outlook.MailItem)
            new Microsoft.Office.Interop.Outlook.ApplicationClass().CreateItem(
            Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);
 
        mailItem.Subject ="Mon sujet";
        mailItem.Body ="Mon message";
        mailItem.To = "Olivier_helin@dietsmann.com";
        mailItem.Save();
        mailItem.Send();
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>