![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
SSL POP3 with CertificatesDemonstrates how to use a client-side certificate with an SSL connection to a POP3 server. Also demonstrates how to get the POP3 server's SSL certificate.
<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_9_5_0.MailMan") ' Any string argument automatically begins the 30-day trial. success = mailman.UnlockComponent("30-day trial") If (success <> 1) Then Response.Write "Component unlock failed" & "<br>" End If ' Set the GMail account POP3 properties. mailman.MailHost = "pop.gmail.com" mailman.PopUsername = "chilkat.support" mailman.PopPassword = "****" mailman.PopSsl = 1 mailman.MailPort = 995 ' Use our certificate, which is already installed ' in our current-user certificate store on the computer. set clientCert = Server.CreateObject("Chilkat_9_5_0.Cert") success = clientCert.LoadByCommonName("Chilkat Software, Inc.") If (success <> 1) Then Response.Write clientCert.LastErrorText & "<br>" End If ' Note: The GMail POP3 server does not require that you ' have a client cert. This example only demonstrates ' how you may use a client certificate. Typically, ' higher-security systems may require a client-side SSL cert. mailman.SetSslClientCert clientCert ' Establish a POP3 connection: success = mailman.Pop3BeginSession() If (success <> 1) Then Response.Write mailman.LastErrorText & "<br>" End If ' Let's look at the LastErrorText to see the details ' of the successful connection. We should see our cert: Response.Write Server.HTMLEncode( mailman.LastErrorText) & "<br>" ' OK, now examine the server's cert: Set serverCert = mailman.GetPop3SslServerCert() If (serverCert Is Nothing ) Then Response.Write "No server cert available." & "<br>" Else Response.Write Server.HTMLEncode( "Server SSL certificate:") & "<br>" Response.Write Server.HTMLEncode( serverCert.SubjectDN) & "<br>" ' Was the server certificate verified? ' It's not necessarily an error if the SSL Server cert is not verified. If (mailman.Pop3SslServerCertVerified = 1) Then Response.Write Server.HTMLEncode( "Server SSL certificate was verified.") & "<br>" Else Response.Write Server.HTMLEncode( "Server SSL certificate was NOT verified!") & "<br>" End If End If %> </body> </html> |
||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.