The jpeg attachment of this EML file is included in the PDF created from the email

Hi,

I updated to Aspose.Email .Net (and Aspose.Word .Net) 18.3 today, With this new version one of our integration test fails because the generated pdf file from one eml file contains now more pages than expected. It looks like that the jpeg attachment of the file is included in the mhtml file that is generated when saving the email. I may be that is intended and not a fault of the software. But this is not a desired result for our software.

Is there a way to disable this behavior?

I included the original eml file and the result of 18.3 and 18.2.

EMLMessage.zip (2.2 MB)
Aspose.zip (2.7 MB)

The code we use is:
MemoryStream stream = new MemoryStream();
theMessage.Save(stream, Aspose.Email.SaveOptions.DefaultMhtml);
stream.Seek(0, SeekOrigin.Begin);
Aspose.Words.LoadOptions loadOptions = new Aspose.Words.LoadOptions();
loadOptions.LoadFormat = Aspose.Words.LoadFormat.Mhtml;
Aspose.Words.Document doc = new Aspose.Words.Document (stream, loadOptions);
Aspose.Words.Saving.PdfSaveOptions options = new Aspose.Words.Saving.PdfSaveOptions();
options.Compliance = PdfCompliance.Pdf15;
doc.Save(fileName, saveOptions);

@andreas4e47b,

Thank you for writing to Aspose support team.

I have tested the sample code using both Aspose.Email for .NET 18.2. and 18.3 both and observed that both produce similar PDF output which contain extra attachment image at the end of PDF. However the PDF files which you have provided are different as “EMLMessage with 18.2.pdf” does not have this extra attachment image at the end. Could you please confirm which version of Aspose.Email you used for creating this “EMLMessage with 18.2.pdf” file? It will help us to analyze the problem and provide assistance accordingly.

Hi, I just retested this with our software version that stil uses Aspose.Email 18.2 and I’m getting a PDF with just the body (two pages) without the jpeg attachment.The exact file version of the Aspose.Email.dll is 18.2.0.0. We uses the NuGet package to install it into the C# project.

I also rolled back the upgrade to 18.3 in the project and rerunned the intergration test with the same result (two page pdf without the jpeg attachment)

@andreas4e47b,

Thank you for providing more information. This issue is re-produced with Aspose.Email for .NET 18.3.0 and logged under Id:EMAILNET-38949 for further investigation. We will write back here once the issue is identified and feedback is ready to share.

@andreas4e47b,

You may please use MhtSaveOptions.SaveAttachments = false to avoid rendering the attachment image in the PDF and share the feedback.

MailMessage theMessage = MailMessage.Load(@"EMLMessage.eml");
MhtSaveOptions opt = new MhtSaveOptions();
opt.SaveAttachments = false;
//theMessage.Save(@"EMLMessage18.3.mht", opt);
MemoryStream stream = new MemoryStream();
theMessage.Save(stream, opt);
stream.Seek(0, SeekOrigin.Begin);
Aspose.Words.LoadOptions loadOptions = new Aspose.Words.LoadOptions();
loadOptions.LoadFormat = Aspose.Words.LoadFormat.Mhtml;
Aspose.Words.Document doc = new Aspose.Words.Document(stream, loadOptions);
Aspose.Words.Saving.PdfSaveOptions options = new Aspose.Words.Saving.PdfSaveOptions();
options.Compliance = PdfCompliance.Pdf15;
doc.Save(@"output18.3.pdf", options);

Hi, we finally had some time to look into this, but unfortenatly setting the option SaveAttachments to false will also prevent that al other inline images of the mail will be show in the html. I tested with version 18.8.

I still think this is a bug in apsose.email. When I save the email to html I expect only the body to be saved in the html not the attachments, even when there are image attachments. Only inline images should be saved in the html.

@andreas4e47b,

We were unable to reproduce the issue you mentioned in the latest Aspose.Email API. The output generated by the code given below is attached.output18.8.pdf (484.7 KB)
The generated output contains inline images only.

Aspose.Email.MailMessage theMessage = 
Aspose.Email.MailMessage.Load(@"EMLMessage.eml");
MhtSaveOptions opt = new MhtSaveOptions();
opt.SaveAttachments = false;
//theMessage.Save(@"EMLMessage18.3.mht", opt);
MemoryStream stream = new MemoryStream();
theMessage.Save(stream, opt);
stream.Seek(0, SeekOrigin.Begin);
Aspose.Words.LoadOptions loadOptions = new Aspose.Words.LoadOptions();
loadOptions.LoadFormat = Aspose.Words.LoadFormat.Mhtml;
Aspose.Words.Document doc = new Aspose.Words.Document(stream, loadOptions);
Aspose.Words.Saving.PdfSaveOptions options = new 
Aspose.Words.Saving.PdfSaveOptions();
options.Compliance = PdfCompliance.Pdf15;
doc.Save(@"output18.8.pdf", options);

Hope this resolved your issue. Please feel free to contact us if you need any further information.

Hi, I retested this and you are correct. Sorry for that. I did not test this myself and I misunderstood my colleague or he was mistaken. The images are correct in the mhtml file.

However, the Attachments header is now missing. Is there a way to include the list of Attachments?

@andreas4e47b,

You are right about the attachment header missing. A ticket has been logged in our issue tracking system as EMAILNET-39098 to look at you specific scenario. We will get back to you as soon as we have additional information.

The issues you have found earlier (filed as EMAILNET-39098) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan