We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Attached images to pdf from email


I’m using aspose total to convert email with attached images to pdf and I’ve noticed some attached images are displaying below of my message when I convert to pdf.
So, is there an option in the aspose that we can choose to display or not attached images with the message?
In my case, I don’t want display these images with my message.

My code is simple:
MemoryStream emailPdfStream;
var mailMsg = MailMessage.Load(stream);
using (var ms = new MemoryStream())
//Save as MHTML
mailMsg.Save(ms, Aspose.Email.Mail.SaveOptions.DefaultMhtml);

// send “ms” variable to my method below:

// ms == stream
//create an instance of LoadOptions and set the LoadFormat to Mhtml
var loadOptions = new Aspose.Words.LoadOptions { LoadFormat = Aspose.Words.LoadFormat.Mhtml };
//create an instance of Document and load the MTHML from MemoryStream
var document = new Aspose.Words.Document(stream, loadOptions);

// Set PaperSize as Letter to make sure every page
// has the size.
foreach (Section sec in document.Sections)
sec.PageSetup.PaperSize = PaperSize.Letter;

var saveOptions = new Aspose.Words.Saving.PdfSaveOptions();
var pdfStream = new MemoryStream();

//save the document to pdf file
document.Save(pdfStream, saveOptions);


Hi Marcelo,

Thank you for writing to Aspose Support team.

Aspose.Email API includes the inline images in output MHTML file and no attachment file will be added to the output. This is a known behavior. If your expected output is different than this, please share your sample message file with us so that we can investigate it at our end for assisting you further.