Spire.Email for .NET is a professional .NET Email library specially designed for developers to create, read and manipulate emails from any .NET (C#, VB.NET, ASP.NET) platform with fast and high quality performance.

Mon Mar 07, 2022 10:11 am

Hi, I am trying to convert an EML file into an image file.. Im facing a problem when there is an embedded image using source from link inside the eml file.. below is the image that I get after convert
https://imgur.com/a/VBplS1E

Here is the part of the sample of the eml content :
Code: Select all
<html><head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dutf-8"><s=
tyle type=3D"text/css">
body {
   margin-left: 0px;
   margin-top: 0px;
   margin-right: 0px;
   margin-bottom: 0px;
   font-family:Lucida Grande,Geneva,Verdana,Arial,Helvetica,sans-serif;
   font-size:11px;
   display: block;
}
img {display:block;}

</style></head><body><table border=3D"0" cellspacing=3D"0" cellpadding=3D"0=
" width=3D"600"><tbody><tr><td><img src=3D"https://www.sample.com/images/e=
mail-blast/sample.aspx" width=3D"600" usemap=3D"#Map" s=
tyle=3D"DISPLAY:block" border=3D"0"> </td></tr></tbody></table><br><span st=
yle=3D"FONT-FAMILY: 'Times New Roman', 'serif'; FONT-SIZE: 12pt; mso-fareas=
t-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-langu=
age: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"><span st=
yle=3D"font-family: Times New Roman;">*************************************=
******************************* </span></span></body></html>=


How can I shown the embedded image as well? Please advise..

xiao0207
 
Posts: 43
Joined: Thu Dec 13, 2018 9:50 am

Tue Mar 08, 2022 2:41 am

Hello,

Thanks for your inquiry!

I simulated an EML file according to the HTML code you provided, and converted it to image with the latest Spire.Office Platinum(Hotfix) Version:7.2.3 by the following code, but did not reproduce your issue. Here I also attached my testing file for your reference.
Code: Select all
            MailMessage message = MailMessage.Load(@"F:\Demos\EmailDemos\Data\Sample.eml");
            string htmlBody = message.BodyHtml;
            Document doc = new Document();
            Spire.Doc.Section section = doc.AddSection();
            Paragraph paragraph = section.AddParagraph();
            paragraph.AppendHTML(htmlBody);
            Image[] images = doc.SaveToImages(Spire.Doc.Documents.ImageType.Bitmap);
            int i = 0;
            foreach(Image image in images)
            {
                image.Save(i + ".png");
                i++;
            }

If you are not using the latest version, I just recommend you try it first. If the issue still exists, please provide us with your input file and testing code for further investigate. Thanks in advance!

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Fri Mar 11, 2022 7:18 am

Hello,

Greetings from E-iceblue.

How is the issue now? If it still exists, could you please provide us with the information I mentioned before for further investigation?

Thanks in advance.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Return to Spire.Email