Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

new outlook email

$
0
0
Hey all,

I just want to be able to open a new mail in outlook.
I've been fighting with this for quite some time now.

Can't somebody point me in the right direction ? thx Smile


Code Block

        private void menuItem7_Click(object sender, System.EventArgs e)
        {
           
           
            Outlook.Application outlook = new Outlook.ApplicationClass();

            try
            {
           
                outlook = (Outlook.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Outlook.Application");
            }
            catch (System.Exception ex)
            {
               
                outlook = new Outlook.ApplicationClass();
            }
           
            Outlook.MailItem mail = outlook.CreateItem(Outlook.OlItemType.olNoteItem);

           
           
            object objDummy = mail.GetInspector;
            mail.Recipients.Add("axel@mail.com");
            mail.Subject = "Betreff"; //
            mail.BodyFormat = Outlook.OlBodyFormat.olFormatPlain;
            mail.Display();
            // mail.Send();
        }


  Outlook.MailItem mail = outlook.CreateItem(Outlook.OlItemType.olNoteItem);
--> is the problem.

I've tried other combination,including making the mailItem, but them i'm not allowed.

It cant be that hard to open a new mail with body and recipient filled in ? Sad

little help please


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>