Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
|
|
POP3 Verify DKIM SignaturesDownload the email from a POP3 mailbox and verify each DKIM or DomainKey signature.
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <% ' The mailman object is used for receiving (POP3) ' and sending (SMTP) email. set mailman = Server.CreateObject("Chilkat.MailMan2") ' Any string argument automatically begins the 30-day trial. success = mailman.UnlockComponent("30-day trial") If (success <> 1) Then Response.Write "<pre>" & Server.HTMLEncode( mailman.LastErrorText) & "</pre>" End If ' We'll also be needing the Chilkat DKIM object. ' The Chilkat DKIM functionality is included in the "Chilkat MIME" license. set dkim = Server.CreateObject("Chilkat.Dkim") success = dkim.UnlockComponent("30-day trial") If (success <> 1) Then Response.Write "<pre>" & Server.HTMLEncode( dkim.LastErrorText) & "</pre>" 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: ' saUidls is a Chilkat.CkStringArray Set saUidls = mailman.GetUidls() If (saUidls Is Nothing ) Then Response.Write "<pre>" & Server.HTMLEncode(mailman.LastErrorText) & "</pre>" 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. 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 = 1) Then Response.Write "<pre>" & Server.HTMLEncode( "DKIM signature " _ & k & " verified") & "</pre>" Else Response.Write "<pre>" & Server.HTMLEncode( "DKIM signature " _ & k & " invalid") & "</pre>" Response.Write "<pre>" & Server.HTMLEncode( dkim.LastErrorText) & "</pre>" 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 = 1) Then Response.Write "<pre>" & Server.HTMLEncode( "DomainKey signature " _ & k & " verified") & "</pre>" Else Response.Write "<pre>" & Server.HTMLEncode( "DomainKey signature " _ & k & " invalid") & "</pre>" Response.Write "<pre>" & Server.HTMLEncode( dkim.LastErrorText) & "</pre>" End If Next Next %> </body> </html> |
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.