Free Support Forum - aspose.com

Embedded images in EML message are not included while converting


#1

We are loading EML file using Aspose.Network.Mail.MailMessage.Load(InputDataStream, Aspose.Network.Mail.MessageFormat.Eml);
Then we are converting msg.HtmlBody to image using TiffBitmapDecoder.
But embedded images are not included in the converted image.
Can you please check and let us know your suggestions ?

We are currently using 3.4.0.0 version of Aspose.Email dll.
Same issue exists with latest version 19.4 of Aspose.Email.dll.

Thanks


#2

@Ganesh.Hegde,

Can you please share source file along with generated result and complete sample code so that we may further investigate to help you out.


#3

Hi Adnan,

Ok sure. Please find attached the files.
Code.txt - Code details that we have used
Email4.eml - EML file used for testing purpose (Please maintain confidentiality for this email)
ConvertedImage.003 - Converted image

Please check the issue and let us know your suggestions.

Thanks.Details.zip (49.9 KB)


#4

@Ganesh.Hegde,

I have observed the sample code and its using legacy Aspose.Network API. Can you please share latest sample code that you have used using Aspose.Email for .NET 19.4 API with which you are able to reproduce the issue on your end.


#5

Hi Mudassir,

We are using the shared code in production also. I have not made any changes while trying with latest version.
Can you please check the existing code and let me know any suggestions you have for resolving this issue.

Thanks


#6

I have tried with Aspose.Email with latest version 19.4
But still it is not working.
Please find attached the updated code using Aspose.Email methods.

Let me know if you need any further details.

ThanksLatestCode.zip (938 Bytes)


#7

@Ganesh.Hedge,

Thank you for sharing the information. I have tried using the sample code and unfortunately I am unable to use it owing to custom class calls. Can you please provide a working sample example that we may use on our end to verify the issue.


#8

Ok. Can you please try it on your regular sample code and check if is having the mentioned issue ?
I tried with various versions and methods but it doesnt work.
Also one more observation is that issue exists in message format also. Email message (.msg) with embedded images are not included while converting to TIFF image.

Please help with this issue.


#9

@Ganesh.Hegde,

I have used following sample code to export EML to MHT format and it is exported fine. As shared earlier, we are unable to use your custom code on our end. However, from API point of view the rendered output does have embedded image inside it.

    public static void TestMsgConversion()
    {

        Aspose.Email.MailMessage msg = new Aspose.Email.MailMessage();
        EmlLoadOptions emlOptions = new EmlLoadOptions();
        emlOptions.PreserveEmbeddedMessageFormat = true;
        emlOptions.PreserveTnefAttachments = true;
        String path = @"c:\email\";
        msg = Aspose.Email.MailMessage.Load(path+ "Email4.eml", emlOptions);

        msg.Save(path+"output.mht", SaveOptions.DefaultMhtml);


    }

output.zip (15.8 KB)


#10

Mudassir,

Thanks for the details.
I checked with latest version but embedded images are not carried while converting to images.
Please find attached the sample source code which we have used for converting Eml and Msg files to images.
AsposeTest.zip (10.7 KB)
Please let us know your suggestions,

Thanks


#11

@Ganesh.Hegde,

Thank you for sharing the information. An issue with ID EMAILNET-39464 has been created in our issue tracking system to further investigate the issue. We will share notification with you as soon as the issue will be fixed. For the time being you may also consider earlier shared approach to export EML to MHT and then using Aspose.Words to export that to TIFF.


#12

Mudassir,

Thanks for the details.
Please share when can we expect fix for the issue.

We tried to convert EML to MHT and then to TIFF using the sample code shared prior.
Saved Mht file contains the images but converted Tiff image doesn’t contain the embedded images.
This scenario is happening with MSG file also.
Please review and let us know your suggestions.

Thanks.


#13

@Ganesh.Hegde,

We are going to verify this issue w.r.t Aspose.Words that why MHT failed to include images in Tiff.


#14

@Ganesh.Hegde,

We have converted the MHT file to TIFF using the latest version of Aspose.Words for .NET 19.4 and have not found the shared issue. Please use Aspose.Words for .NET 19.4. We have attached the output TIFF file with this post for your kind reference. 19.4.zip (55.1 KB)


#15

Tahir,

Thanks for the information.
We have used latest version of Aspose.Words with the sample code shared by us.
It is not including the embedded images.
Please find attached the sample code. check the source code and let us know if there are any suggestions.

ThanksAsposeTest.zip (10.8 KB)


#16

@Ganesh.Hegde,

In your code, you are using msg.HtmlBody as shown below. The HTML does not have the image.

byte[] HtmlBuffer = Encoding.ASCII.GetBytes(msg.HtmlBody);

We suggest you please convert the .mht file to .tiff file format using Aspose.Words as shown below to get the desired output.

Document doc = new Document(MyDir + "Output1.mht"); 
doc.Save(MyDir + "19.4.tiff");

#17

Tahir,

Thanks for the suggestions.
Code that I have shared is a sample code which is taken from a complex Convert application which serves as single application to convert all types of files along with some other important functionality.
It is designed systematically to use stream objects instead of processing with actual file objects.
So I would request you to provide suggestion with respect to the sample code shared.

Is there any way to get the stream object for the email body which should include the embedded images also ? We should be able to accommodate this issue with less coding changes so that it doesnt affect the client at whole.

Thanks


#18

@Ganesh.Hegde,

We have already logged issue based on information provided earlier over following thread link.

The other approach that I had shared with you was to export MSG to MHT and then use Aspose.Words to export MHT to Tiff.


#19

Thanks Mudassir.

Please note that same issue exists with message file also. It doesnt include embedded images while conversion.
Other approach may not work for our scenario. According to the details mentioned by me in previous post, we will not be able to convert the complete image into Tiff directly since we are doing some manipulation related to email subject, To and From etc.
So it would be helpful if you provide suggestions/fix according to the sample code shared.

We would be looking forward to get status on the issue fix.

Thanks


#20

@Ganesh.Hegde,

I have observed your requirements related to issue being reproduced in MSG file. I suggest you to please share the MSG file reproducing the issue so that we may separately log the issue in our issue tracking system.