c# - Outlook mail integration with .net Desktop application -


i have window application running on system in can send mail through anywhere want integrate application outlook.

1.sent mail should show in outlook sent mail folder. 2.in case mail sending fail should display in outbox folder of outlook

go through following code:

outlook.application oapp = new outlook.application();  if (this.listviewcontacts.selecteditems != null && this.listviewcontacts.selecteditems.count > 0) { outlook.contactitem orecip = (outlook.contactitem) (this.listviewcontacts.selecteditems[0].tag);  outlook.mailitem email = (outlook.mailitem) (oapp.createitem(outlook.olitemtype.olmailitem)); email.recipients.add(orecip.email1address); email.subject = "just wanted say..."; email.body = "have great day!";  if (messagebox.show( "are sure want send day message " + orecip.email1displayname + "?", "send?", messageboxbuttons.okcancel) == dialogresult.ok) { try { ((outlook.mailitem)email).send(); messagebox.show("email sent successfully.", "sent"); } catch (exception ex) { messagebox.show("email failed: " + ex.message, "failed send"); } }  orecip = null; email = null; } 

referance link:

http://www.codeguru.com/csharp/csharp/cs_misc/e-mail/article.php/c14293/microsoft-outlook-integration-with-cnet.htm#page-2

step step implementation , explaination given in link.

hope helpful.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -