Hi, I have in the example the following e-mail:

..
<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><img width=384 height=371 id="Bild_x0020_1"
src="cid:image001.png@xx.xx"><o:p></o:p></p>
..

How do I get the picture of this e-mail.

I call my mail such as:

..
Dim ML As New Pop3MessageCollection
Dim MM As MailMessage
..
MM = New MailMessage
MM = POP3.GetMailMessage(ML(x).SequenceNumber)
..
Dim HTMLPART as String = MM.BodyHtml

Thanks and regards

asked 27 Jul '10, 08:20

John%202's gravatar image

John 2
16
accept rate: 0%


You can find this picture in MailMessage object's Resources collection. This contains instances of LinkedResource whose ContentId.Id property is the "cid" value (such as "image001.png@xx.xx").

Sample code:

    Dim MM As MailMessage
    MM = POP3.GetMailMessage(ML(x).SequenceNumber)
    Dim HTMLPART As String = MM.BodyHtml

    For Each RESOURCE As LinkedResource In MM.Resources
        If Not RESOURCE.ContentId Is Nothing _
            And RESOURCE.ContentId.Id = "image001.png@xx.xx" Then

            ' do something with the resource
            RESOURCE.Save("image001.png")

        End If
    Next
link

answered 27 Jul '10, 10:54

Lukas%20Pokorny's gravatar image

Lukas Pokorny ♦♦
2.2k18
accept rate: 32%

Thank you very much, it works great.

link

answered 27 Jul '10, 11:17

John%203's gravatar image

John 3
16
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×46
×33
×14
×5
×2

Asked: 27 Jul '10, 08:20

Seen: 331 times

Last updated: 22 Mar '11, 22:23