DecodeMstnef Method


Extracts attachments from MS-TNEF (winmail.dat) attachment if any, removes MS-TNEF attachments from Attachments collection, and returns the number of extracted files.

MS-TNEF is a proprietary e-mail format designed by Microsoft. In some cases, MS Outlook encapsulates files attached to e-mail message into a single MS-TNEF attachment. You should use this method to extract attachments from such e-mail messages.


lngCount = ObjectName.DecodeMstnef  
Parameters: None 
Return value As Long Number of extracted files if succeeded, 0 if no MS-TNEF was found in the attachments collection, -1 if there was error during extraction.  

Usage example:

Dim Mailer, Msg, Attach
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.POP3")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.POP3")
'In ASP use Response.Write instead of MsgBox
Mailer.LicenseKey = "put your license key here"
Mailer.Connect "mailserver.com", 110, "MyName", "MyPassword"
If Mailer.Connected Then
  If Mailer.MessageCount > 0 Then
    Set Msg = Mailer.RetrieveSingleMessage(1)
    MsgBox "Extracted " & Msg.DecodeMstnef & " files from winmail.dat"
    If Not Msg Is Nothing Then
      For Each Attach In Msg.Attachments
        MsgBox "Content: " & Attach.Content
      Next
    End If
  End If
  Mailer.Disconnect
End If

See Also:

Attachments Property


Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.