0 votes
by (120 points)
edited

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

Applies to: Rebex Secure Mail

2 Answers

0 votes
by (147k points)
edited

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
0 votes
by (140 points)
edited

Thank you very much, it works great.

...