I'm trying to build an E-mail viewer.
To do this, I access my IMAP server and get mail, using the ComponentSoft.Net.Mail
DLL.
After getting the message, I want to display it in my viewer.
However, I'm having problems with the Linked resources, this is because I do not want to save them physically but only save to MemoryStream
or Byte array in the DB.
The problem is getting the image of any of these sites, because I want to put it back as a CID in the Body of the email, so that my viewer can present it. However I am not able to get this CID.
What to do?
For better understanding I put the code I'm using:
Dim img As Drawing.Image = Drawing.Image.FromStream(email.LinkedResources(i).GetContentStream)
Dim converter As New Drawing.ImageConverter
Dim byteImage As Byte() = converter.ConvertTo(img, GetType(Byte()))
Dim base64 As String = System.Convert.ToBase64String(byteImage)
Dim LR As String = "cid:" + email.LinkedResources(i).ContentIdentifier
If MailBody.Contains(LR) Then
MailBody = Replace(MailBody, LR, "<img src=data:image/gif;base64," + base64)
End If