How do i show a attached image in C# generated outlook email [modified]
-
Hi, I made a program that launched a outlook email window and puts a attached file in it:
private Outlook.Application oApp = new Outlook.Application(); Outlook.MAPIFolder outBoxfolder = oApp.GetNamespace("MAPI").GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderOutbox); Outlook.MailItem mItem = (Outlook.MailItem)outBoxfolder.Items.Add(Outlook.OlItemType.olMailItem); mItem.Attachments.Add("D:\\test.jpg", Type.Missing, Type.Missing, Type.Missing); mItem.To = ""; mItem.BCC = ""; mItem.CC = ""; mItem.Subject = ""; mItem.BodyFormat = Outlook.OlBodyFormat.olFormatHTML; mItem.HTMLBody = ""; mItem.Display(new object());
As you can see i want to display the attached file(image) in my mail, but, it doesn't work. The image is attached and you can see it in the attachments and dubbelclick it so it shows. But you cannot see it in de the body of the mail. The reason is because the imagelink "" in the HTMLBody isn't right, but what is right??? How do i make the link so it shows the image that is located in the attachment on my HTMLBody? please help me??? greetz Willem -- modified at 10:24 Wednesday 17th October, 2007
-
Hi, I made a program that launched a outlook email window and puts a attached file in it:
private Outlook.Application oApp = new Outlook.Application(); Outlook.MAPIFolder outBoxfolder = oApp.GetNamespace("MAPI").GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderOutbox); Outlook.MailItem mItem = (Outlook.MailItem)outBoxfolder.Items.Add(Outlook.OlItemType.olMailItem); mItem.Attachments.Add("D:\\test.jpg", Type.Missing, Type.Missing, Type.Missing); mItem.To = ""; mItem.BCC = ""; mItem.CC = ""; mItem.Subject = ""; mItem.BodyFormat = Outlook.OlBodyFormat.olFormatHTML; mItem.HTMLBody = ""; mItem.Display(new object());
As you can see i want to display the attached file(image) in my mail, but, it doesn't work. The image is attached and you can see it in the attachments and dubbelclick it so it shows. But you cannot see it in de the body of the mail. The reason is because the imagelink "" in the HTMLBody isn't right, but what is right??? How do i make the link so it shows the image that is located in the attachment on my HTMLBody? please help me??? greetz Willem -- modified at 10:24 Wednesday 17th October, 2007
In the meantime, i found out that i have to supply my attachment with a EntryId(that wat its called in VBA) but in c# my attachment doesn't have this value(so mItem.Attachments[0].EntryId). How can i set my EntryId in C#?