VB.NET Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB.NET Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML to XML
HTTP
IMAP
Encryption
MHT / HTML Email
PFX
RSA Encryption
S/MIME
Socket
Spider
Tar Archive
Upload
XML
XMP
Zip Compression
Misc

More Examples...
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA

Byte Array
VB.NET FTPS
System.IO

Unreleased...
Bzip2
LZW
Bz2
Icon

 

 

 

 

 

 

Testing for MDN and Parsing a MDN (Message-Delivery-Notification) Email

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 1.0 / 1.1 Framework

This example demonstrates how to test for and parse a message-delivery-notification (MDN) email.

        ' This example demonstrates how to test a Chilkat.Email object to find out
        ' if it is an MDN (Message Delivery Notification) email.
        ' For the example, we have already saved a copy of an MDN in mdn.eml.
        Dim email As New Chilkat.Email()
        email.UnlockComponent("anything for 30-day trial")

        email.LoadEml("mdn.eml")

        ' MDN messages have a content-type of multipart/report
        Dim hdrFieldValue As String
        ' The GetHeaderField method returns the full contents of a given header field.
        ' For MDN messages, it may look like this:
        ' multipart/report; boundary="_"; report-type=disposition-notification
        hdrFieldValue = email.GetHeaderField("content-type")

        If (hdrFieldValue.Contains("multipart/report")) Then
            MessageBox.Show("Yes! This is an MDN!")
        End If

        ' The MDN MIME contains two sub-parts. The first is a human-readable
        ' text/plain MIME part, and the 2nd has a content type of "message/disposition-notification"

        ' We can use Chilkat.Mime to parse the MDN:
        Dim mime As Chilkat.Mime
        ' Convert the Chilkat.Email object into a Chilkat.Mime object.
        mime = email.GetMimeObject()
        ' Unlocking only needs to be called once in a program
        mime.UnlockComponent("anything for 30-day trial")

        Dim textPart As Chilkat.Mime
        Dim dispPart As Chilkat.Mime

        textPart = mime.GetPart(0)
        dispPart = mime.GetPart(1)

        ' Show the human-readable MIME text in the text/plain message part.
        MessageBox.Show(textPart.GetBodyDecoded())

        ' The message/disposition-notification part wraps another MIME message
        ' that can be parsed with Chilkat.Mime
        Dim mimeBody As String
        mimeBody = dispPart.GetBodyDecoded()

        Dim dispMime As New Chilkat.Mime()
        dispMime.LoadMime(mimeBody)

        ' Get these fields: Reporting-UA, Final-Recipient, Original-Message-ID, Disposition
        ListBox1.Items.Add("Reporting-UA: " + dispMime.GetHeaderField("Reporting-UA"))
        ListBox1.Items.Add("Final-Recipient: " + dispMime.GetHeaderField("Final-Recipient"))
        ListBox1.Items.Add("Original-Message-ID: " + dispMime.GetHeaderField("Original-Message-ID"))
        ListBox1.Items.Add("Disposition: " + dispMime.GetHeaderField("Disposition"))




 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2007 Chilkat Software, Inc. All Rights Reserved.

Mail Component · XML Parser