On Click of a button I need to open an Outlook mail box with an email id in the To and with a specifc message typed in and with a file attached ( specified by the user in a txtbox on a form) ?
Printable View
On Click of a button I need to open an Outlook mail box with an email id in the To and with a specifc message typed in and with a file attached ( specified by the user in a txtbox on a form) ?
=) System.Diagnostics.Process.Start("mailto:[email protected]");
Thanks for that.
How about attaching files?
Well...if your sending e-mails try the System.Mail class..you have to add a refrence to it. Or make your own mail sender, or you can check Microsoft.com for how to use outlook through a command line..
-toto
Here is the working code:
Outlook.Application oApp=new Outlook.Application();
Outlook._NameSpace oNameSpace=oApp.GetNamespace("MAPI");
oNameSpace.Logon("",null,false,false);
Outlook._MailItem om = (Outlook._MailItem)
oApp.CreateItem(Outlook.OlItemType.olMailItem);
om.Attachments.Add("C:\\ivan.txt",1,1,"Ivan");
om.To = "[email protected]";
om.Subject = "VC# is Great";
om.Body="dfgfdgf";
om.Display(false);
Uses Microsoft Outlook lib
Thanks toto for the help extended.
Thanks! You just saved me a bunch of work.
Hi
i could not add a reference to outlook.. i added microsoft outlook library 10.0.. but still it underlines during compilation..
pls help
thanks