Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How do i show a attached image in C# generated outlook email [modified]

How do i show a attached image in C# generated outlook email [modified]

Scheduled Pinned Locked Moved C#
questioncsharpcomhelp
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    willempipi
    wrote on last edited by
    #1

    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 = "![](test.jpg)"; 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

    W 1 Reply Last reply
    0
    • W willempipi

      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 = "![](test.jpg)"; 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

      W Offline
      W Offline
      willempipi
      wrote on last edited by
      #2

      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#?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups