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. HTML EMail with embedded images

HTML EMail with embedded images

Scheduled Pinned Locked Moved C#
csharphtmlhardwarequestion
5 Posts 4 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.
  • B Offline
    B Offline
    Braulio Dez
    wrote on last edited by
    #1

    Hi, How can I generate EMails with HTML and send them using C# / .net. Sorry but I have no idea about how that kind of e-mail works ( if there is an standard format to have the pics and content embedded or...). Thanks in advance, Greetings Braulio

    H 1 Reply Last reply
    0
    • B Braulio Dez

      Hi, How can I generate EMails with HTML and send them using C# / .net. Sorry but I have no idea about how that kind of e-mail works ( if there is an standard format to have the pics and content embedded or...). Thanks in advance, Greetings Braulio

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      This is done using MIME (Multipurpose Internet Mail Extensions). You should first understand how SMTP works and how basic email messages are formatted. It's similar in concept to HTTP, in that you provide headers, skip a line, and begin your content. MIME adds content types, including multipart which allows you to include text, html, images, and more. Image should, of course, be encoded as text (typically base64-encoded, but could be anything so long as clients support it). For some information about MIME, you can google. There is a specific section on MSDN, MIME Extensions to Internet Mail[^] (kinda of redundant, but oh well) that also includes a sample of a MIME message. It also includes information on many common types used in MIME messages, but you can use anything so long as it can be interpreted by the email client (if it isn't, only the parts of the email that are understood are displayed).

      Microsoft MVP, Visual C# My Articles

      M 1 Reply Last reply
      0
      • H Heath Stewart

        This is done using MIME (Multipurpose Internet Mail Extensions). You should first understand how SMTP works and how basic email messages are formatted. It's similar in concept to HTTP, in that you provide headers, skip a line, and begin your content. MIME adds content types, including multipart which allows you to include text, html, images, and more. Image should, of course, be encoded as text (typically base64-encoded, but could be anything so long as clients support it). For some information about MIME, you can google. There is a specific section on MSDN, MIME Extensions to Internet Mail[^] (kinda of redundant, but oh well) that also includes a sample of a MIME message. It also includes information on many common types used in MIME messages, but you can use anything so long as it can be interpreted by the email client (if it isn't, only the parts of the email that are understood are displayed).

        Microsoft MVP, Visual C# My Articles

        M Offline
        M Offline
        Mazdak
        wrote on last edited by
        #3

        Heath , why don't you advise him MailMessage Class? Mazy "Improvisation is the touchstone of wit." - Molière

        N H 2 Replies Last reply
        0
        • M Mazdak

          Heath , why don't you advise him MailMessage Class? Mazy "Improvisation is the touchstone of wit." - Molière

          N Offline
          N Offline
          Nick Parker
          wrote on last edited by
          #4

          Mazdak wrote: Heath , why don't you advise him MailMessage Class? While you can send standard HTML with the MailMessage class, the poster originally asked about embedding content including images which would require the use of MIME as Heath noted. - Nick Parker
            My Blog

          1 Reply Last reply
          0
          • M Mazdak

            Heath , why don't you advise him MailMessage Class? Mazy "Improvisation is the touchstone of wit." - Molière

            H Offline
            H Offline
            Heath Stewart
            wrote on last edited by
            #5

            Because it doesn't allow you to send pictures as part of the HTML body, only to include a URL from an external resource. You can include attachments, but without using the right MIME header the HTML body won't resolve the attached image correctly.

            Microsoft MVP, Visual C# My Articles

            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