01.public void sendEMailThroughOUTLOOK()
02. {
03. try
04. {
05. Outlook.Application oApp = new Outlook.Application();
06.
07. Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
08.
09. string imageCid = "image001.jpg@123";
10. oMsg.HTMLBody = String.Format("<body><img src=\"cid:{0}\"></body>", imageCid);
11. Attachment attachment1 = oMsg.Attachments.Add(@"E:\wallpapers\WRLDMAP.jpg", OlAttachmentType.olEmbeddeditem, null, "img");
12. attachment1.PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x3712001E", imageCid);
13.
14. //Add an attachment.
15. String sDisplayName = "MyAttachment";
16. int iPosition = (int)oMsg.HTMLBody.Length + 1;
17. int iAttachType = (int)Outlook.OlAttachmentType.olByValue;
18. //now attached the file
19.
20. Outlook.Attachment oAttach = oMsg.Attachments.Add(@"C:\\SampleFile.txt", iAttachType, iPosition, sDisplayName);
21.
22. //Subject line
23. oMsg.Subject = "Your Subject will go here.";
24. // Add a recipient.
25. Outlook.Recipients oRecips = (Outlook.Recipients)oMsg.Recipients;
26. Outlook.Recipient oRecip = (Outlook.Recipient)oRecips.Add("abc8@in.com");
27. oRecip.Resolve();
28.
29. oMsg.Send();
30. oRecip = null;
31. oRecips = null;
32. oMsg = null;
33. oApp = null;
34. }
35. catch (System.Exception ex)
36. { }
37.}