Problem with making tiffs from email


I have tried saving to memory stream the email hangs/processes forever and I have tried saving to temp file and the email hangs/processess forever. The hang occurs @

The following function is the code that I am using and the version is 6.9.0 and the aspose.words version is 16.8.0 I have also supplied the email that causes this.
This code processes all of our email except for a few like the one I supplied.

Private Function doRenderEmail(ByVal FilNam
In As String, ByVal FilNam_Out As String, ByVal Filetype As String) As Boolean
' convert MSG to MHTML and save to stream
doRenderEmail = False
Dim msg As MailMessage = MailMessage.Load(FilNamIn)
'Dim msgStream As MemoryStream = Nothing
Dim tFileName As String = Path.Combine(Path.GetTempPath, Path.GetFileNameWithoutExtension(FilNam_In) & "Tst")
msg.Save(tFileName, Aspose.Email.Mail.SaveOptions.DefaultMhtml)
Dim msgDocument As Aspose.Words.Document = New Aspose.Words.Document(tFileName)
'msgStream = New MemoryStream()
msg.Save(msgStream, Aspose.Email.Mail.SaveOptions.DefaultMhtml) 'MailMessageSaveOptions.WriteHeaderToMht)
'msgStream.Position = 0
'Dim msgDocument As Aspose.Words.Document = New Aspose.Words.Document(msgStream)
For Each section As Aspose.Words.Section In msgDocument
section.PageSetup.PaperSize = Aspose.Words.PaperSize.Letter
section.PageSetup.BottomMargin = 20
section.PageSetup.TopMargin = 20
section.PageSetup.LeftMargin = 20
section.PageSetup.RightMargin = 20
'section.PageSetup.Orientation = Orientation.Landscape
Next section
For Each table As Aspose.Words.Tables.Table In msgDocument.GetChildNodes(NodeType.Table, True)
table.AllowAutoFit = True
table.PreferredWidth = Aspose.Words.Tables.PreferredWidth.Auto
Next table
Dim saveoptions As Aspose.Words.Saving.ImageSaveOptions = New Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Tiff)
_saveoptions.ImageColorMode = Aspose.Words.Saving.ImageColorMode.None
_saveoptions.PixelFormat = Aspose.Words.Saving.ImagePixelFormat.Format16BppRgb555
_saveoptions.SaveFormat = Aspose.Words.SaveFormat.Tiff
_saveoptions.TempFolder = Path.GetTempPath
_saveoptions.TiffCompression = Aspose.Words.Saving.TiffCompression.Lzw
_saveoptions.Resolution = 300.0
_saveoptions.UseHighQualityRendering = True
_saveoptions.ColorMode = Aspose.Words.Saving.ColorMode.Normal
_saveoptions.DmlRenderingMode = Aspose.Words.Saving.DmlRenderingMode.Fallback
_saveoptions.DmlEffectsRenderingMode = Aspose.Words.Saving.DmlEffectsRenderingMode.Simplified

Out, saveoptions) 'Aspose.Words.SaveFormat.Tiff)
msgDocument = Nothing
Catch ex As Exception
Dim _msgPrinter As New Aspose.Email.Printing.MailPrinter
_msgPrinter.DpiX = 300.0 : _msgPrinter.DpiY = 300.0
_msgPrinter.FormattingFlags = Aspose.Email.Printing.MessageFormattingFlags.MailInfo
msgPrinter.FormattingFlags += Aspose.Email.Printing.MessageFormattingFlags.AutoFitWidth
msgPrinter.PageUnit = Aspose.Email.Printing.PrinterUnit.Inch
_msgPrinter.MarginTop = 0.25 : _msgPrinter.MarginLeft = 0.25 : _msgPrinter.MarginRight = 0.25 : _msgPrinter.MarginBottom = 0.25
_msgPrinter.PageWidth = 8.5
_msgPrinter.PageHeight = 11.0

' load the MSG file using Aspose.Email for .NET
msg, FilNam_Out, Aspose.Email.Printing.PrintFormat.Tiff)
Catch ex1 As Exception
End Try
' If msgStream IsNot Nothing Then msgStream.Dispose()
If File.Exists(tFileName) Then File.Delete(tFileName)
End Try
Return True

End Function


Hi Lisa,

Thank you for writing to Aspose Support team.

We have loaded the MSG file in MailMessage and saved it to memory stream as MHTML using the latest version of Aspose.Email for .NET, but no such issue of hanging was faced as you have specified. Could you please confirm to us if you are using the latest version of the API at your end? The following code sample was used for testing at our end.

Sample Code:

Dim msg As MailMessage = MailMessage.Load("784575\hanging.msg", New MsgLoadOptions())

Dim ms As New MemoryStream()

msg.Save(ms, Aspose.Email.Mail.SaveOptions.DefaultMhtml)


I am sorry maybe the original post was confusing. It hang when creating the Aspose word document as indicated above.
I am using version 6.9.0 of aspose email and 16.8.0 of aspose words.


Hi Lisa,

Thank you for the details. We managed to replicate the problem of not being able to load the MHTML document. It has been logged under ticket ID WORDSNET-14223 in our bug tracking system. Your post has also been linked to this ticket. We'll keep you informed regarding any available updates. We're sorry for the inconvenience caused.



The issues you have found earlier (filed as WORDSNET-14223) have been fixed in this Aspose.Words for .NET 17.7 update and this Aspose.Words for Java 17.7 update.