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 Signed (S/MIME) EmailDemonstrates how to download and verify digitally signed S/MIME email.
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <% 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 ' Set the POP3 server's hostname mailman.MailHost = "mail.chilkatsoft.com" ' Set the POP3 login/password. mailman.PopUsername = "myLogin" mailman.PopPassword = "myPassword" ' sa is a Chilkat.CkStringArray Set sa = mailman.GetUidls() If (sa Is Nothing ) Then Response.Write "<pre>" & Server.HTMLEncode( mailman.LastErrorText) & "</pre>" End If n = sa.Count For i = 0 To n - 1 uidl = sa.GetString(i) ' email is a Chilkat.Email2 Set email = mailman.FetchEmail(uidl) If (email Is Nothing ) Then Response.Write "<pre>" & Server.HTMLEncode( mailman.LastErrorText) & "</pre>" Exit Do End If Response.Write "<pre>" & Server.HTMLEncode( email.From) & "</pre>" Response.Write "<pre>" & Server.HTMLEncode( email.Subject) & "</pre>" ' The security layers of signed and/or encrypted emails ' are automatically "unwrapped" when loaded into ' a Chilkat email object. ' An application only needs to check to see if an email ' was received signed or encrypted, and then examine ' the success/failure. For example: If (email.ReceivedSigned = 1) Then Response.Write "<pre>" & Server.HTMLEncode( "This email was signed.") & "</pre>" ' Check to see if the signatures were verified. If (email.SignaturesValid = 1) Then Response.Write "<pre>" & Server.HTMLEncode( "Digital signature(s) verified.") & "</pre>" Response.Write "<pre>" & Server.HTMLEncode( "Signer: " _ & email.SignedBy) & "</pre>" ' The certificate used for signing may be obtained ' by calling email.GetSignedByCert. ' cert is a Chilkat.Cert Set cert = email.GetSignedByCert() If (cert Is Nothing ) Then Response.Write "<pre>" & Server.HTMLEncode( "Failed to get signing certificate object.") & "</pre>" Else Response.Write "<pre>" & Server.HTMLEncode( "Signing cert: " _ & cert.SubjectCN) & "</pre>" End If Else Response.Write "<pre>" & Server.HTMLEncode( "Digital signature verification failed.") & "</pre>" End If End If Next mailman.Pop3EndSession %> </body> </html> |
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.