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

Free Support Forum - aspose.com

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 @ _msg.save.

The following function is the code that I am using and the aspose.email 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(FilNam_In)
'Dim msgStream As MemoryStream = Nothing
Dim tFileName As String = Path.Combine(Path.GetTempPath, Path.GetFileNameWithoutExtension(FilNam_In) & “Tst”)
Try
_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

msgDocument.Save(FilNam_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
Try
_msgPrinter.Print(_msg, FilNam_Out, Aspose.Email.Printing.PrintFormat.Tiff)
Catch ex1 As Exception
Finally
End Try
Finally
’ If msgStream IsNot Nothing Then msgStream.Dispose()
If File.Exists(tFileName) Then File.Delete(tFileName)
End Try
_msg.Dispose()
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.

@elumicor,

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.