5
I’m trying to build an E-mail viewer.
To do so, I access my IMAP server and get email using the DLL ComponentSoft.Net.Mail.
After getting the message, I intend to present it in my viewer.
However, I am having problems with Linked Sources, this because I do not intend to store them physically but only store them in MemoryStream or BD byte array.
The problem is getting the image of any of these sites, because I want to put it back as CID in the Body email, so that my viewer presents it. However I am not getting that 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
						
Ever thought of converting the image to String Base64?
– Felipe Avelar
Actually, I was just doing a test using an ashx handler, and I figured I could use the Base64 image. Any tips on how to convert the image to Base64?
– Filipe Vilhena