email - How to open Outlook new mail window on server C# -
i using link open outlook new mail window. how open outlook new mail window c#
but working fine on local machine when deployed on server shows below error.
retrieving com class factory component clsid {0006f03a-0000-0000-c000-000000000046} failed due following error: 80040154 class not registered (exception hresult: 0x80040154 (regdb_e_classnotreg)).
microoft office outlook install on local machine not on server.it required install , configure outlook on server. plz help. thanks.
1. using outlook
to send email using outlook, need add reference dynamic link library outlook called microsoft.office.interop.outlook.dll same follow below steps:
using outlook = microsoft.office.interop.outlook; //method send email outlook public void sendemailthroughoutlook() { try { // create outlook application. outlook.application oapp = new outlook.application(); // create new mail item. outlook.mailitem omsg = (outlook.mailitem)oapp.createitem(outlook.olitemtype.olmailitem); // set htmlbody. //add body of email omsg.htmlbody = "hello, jawed message body go here!!"; //add attachment. string sdisplayname = "myattachment"; int iposition = (int)omsg.body.length + 1; int iattachtype = (int)outlook.olattachmenttype.olbyvalue; //now attached file outlook.attachment oattach = omsg.attachments.add(@"c:\\filename.jpg", iattachtype, iposition, sdisplayname); //subject line omsg.subject = "your subject go here."; // add recipient. outlook.recipients orecips = (outlook.recipients)omsg.recipients; // change recipient in next line if necessary. outlook.recipient orecip = (outlook.recipient)orecips.add("jawed.ace@gmail.com"); orecip.resolve(); // send. omsg.send(); // clean up. orecip = null; orecips = null; omsg = null; oapp = null; }//end of try block catch (exception ex) { }//end of catch }//end of email method for more information open outlook
Comments
Post a Comment