VB.NET Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

VB.NET Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML to XML
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
PFX
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression
Misc

More Examples...
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

Byte Array
VB.NET FTPS
System.IO

 

 

 

 

 

 

POP3 Verify DKIM Signatures

Download the email from a POP3 mailbox and verify each DKIM or DomainKey signature.

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 64-bit 2.0 / 3.5 Framework (x64)

Download Chilkat .NET for 1.0 / 1.1 Framework

'  The mailman object is used for receiving (POP3)
'  and sending (SMTP) email.
Dim mailman As New Chilkat.MailMan()

'  Any string argument automatically begins the 30-day trial.
Dim success As Boolean
success = mailman.UnlockComponent("30-day trial")
If (success <> true) Then
    TextBox1.Text = TextBox1.Text & mailman.LastErrorText & vbCrLf
    Exit Sub
End If


'  We'll also be needing the Chilkat DKIM object.
'  The Chilkat DKIM functionality is included in the "Chilkat MIME" license.
Dim dkim As New Chilkat.Dkim()

success = dkim.UnlockComponent("30-day trial")
If (success <> true) Then
    TextBox1.Text = TextBox1.Text & dkim.LastErrorText & vbCrLf
    Exit Sub
End If


'  Set the POP3 server's hostname
mailman.MailHost = "mail.cknotes.com"

'  Set the POP3 login/password.
mailman.PopUsername = "admin@cknotes.com"
mailman.PopPassword = "myPassword"

'  First, get the complete set of UIDLs for the email in the POP3 mailbox:
Dim saUidls As Chilkat.StringArray
saUidls = mailman.GetUidls()
If (saUidls Is Nothing ) Then
    MsgBox(mailman.LastErrorText)
    Exit Sub
End If


'  Download each email into a byte array
'  If DKIM signature verification is to be performed,
'  it is important to download the email exactly as-is.
Dim i As Long
Dim mimeBytes() As Byte

Dim k As Long
Dim bVerified As Boolean
Dim numDkimSigs As Long
Dim numDomainKeySigs As Long
For i = 0 To saUidls.Count - 1
    mimeBytes = mailman.FetchMime(saUidls.GetString(i))

    '  Verify each DKIM signature, if any exist.
    numDkimSigs = dkim.NumDkimSignatures(mimeBytes)
    For k = 0 To numDkimSigs - 1
        bVerified = dkim.VerifyDkimSignature(k,mimeBytes)
        If (bVerified = true) Then
            TextBox1.Text = TextBox1.Text & "DKIM signature " _
                 & k & " verified" & vbCrLf
        Else
            TextBox1.Text = TextBox1.Text & "DKIM signature " _
                 & k & " invalid" & vbCrLf
            TextBox1.Text = TextBox1.Text & dkim.LastErrorText & vbCrLf
        End If

    Next

    '  Verify each DomainKey signature if any exist.
    numDomainKeySigs = dkim.NumDomainKeySignatures(mimeBytes)
    For k = 0 To numDomainKeySigs - 1
        bVerified = dkim.VerifyDomainKeySignature(k,mimeBytes)
        If (bVerified = true) Then
            TextBox1.Text = TextBox1.Text & "DomainKey signature " _
                 & k & " verified" & vbCrLf
        Else
            TextBox1.Text = TextBox1.Text & "DomainKey signature " _
                 & k & " invalid" & vbCrLf
            TextBox1.Text = TextBox1.Text & dkim.LastErrorText & vbCrLf
        End If

    Next
Next


 

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

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

Mail Component · XML Parser