Free Support Forum - aspose.com

Convert outlook email without attachments

I am able to get the attachments to convert to TIFF one at a time but I am also getting the email with the attachment in it
I would like the email TIFF not to include the attachments in it.

code below:


Dim printer As MailPrinter = New MailPrinter()

printer.FormattingFlags = Aspose.Email.Printing.MessageFormattingFlags.Attachments

Try
printer.FormattingFlags = Aspose.Email.Printing.MessageFormattingFlags.MailInfo
Dim msg As MailMessage = MailMessage.Load(file, MessageFormat.Msg) ', FileCompatibilityMode.PreserveTnefAttachments , Aspose.Email.Mail.MessageFormat.Msg
Dim imagefilename As String

If CaptureCCData.chkMerge.Checked = True Then
'frmMerge.lstattachments.Items.Clear()
CaptureCCData.lstattachments.Items.Clear()
End If

For Each attachment As Attachment In msg.Attachments
'To display the the attachment file name
attachment.Save(Program.imagepath + attachment.Name)

If Len(file) > 0 Then
Select Case LCase(System.IO.Path.GetExtension(attachment.Name))
Case ".tiff"
'Program.ConverttoTIFF(file)
Case ".pdf"
imagefilename = ConvertPDFtoTIFF(Program.imagepath + attachment.Name)
Case ".jpeg", ".gif", ".jpg", ".bmp", ".png"
imagefilename = ConvertjpegtoTIFF(Program.imagepath + attachment.Name)
Case ".doc", ".docx", ".dot"
imagefilename = ConvertWordtoTIFF(Program.imagepath + attachment.Name)
Case ".txt"
imagefilename = ConvertTXTtoTIFF(Program.imagepath + attachment.Name)
Case ".htm", ".html"
imagefilename = ConvertHTMLtoTIFF(Program.imagepath + attachment.Name)
Case ".xls", ".xlsx"
imagefilename = ConvertExcelltoTIFF(Program.imagepath + attachment.Name)
'Case ".msg"
' imagefilename = ConvertEmailtoTIFF(Program.imagepath + attachment.Name)
Case ".pptx", ".ppt", ".pps"
imagefilename = ConvertPowerpointtoTIFF(Program.imagepath + attachment.Name)
Case Else
Debug.WriteLine("Not between 1 and 10, inclusive")
End Select
End If
Next

printer.FormattingFlags = Aspose.Email.Printing.MessageFormattingFlags.MailInfo

printer.Print(msg, imagefilename, Aspose.Email.Printing.PrintFormat.Tiff)
Program.NoOfPages = msg.Count

Catch ex As System.Exception
MsgBox(ex.Message)

End Try

Hi,

Thank you for writing Aspose Support team.

Aspose.Email prints inline images to output TIFF file and doesn’t include any regular attachments such as MSG files to the output. Please share the sample message file and a screenshot of the problem with us so that we can investigate the issue for assisting you further.