Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ Delphi FoxPro Java Perl Python Ruby SQL Server VBScript
|
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.
LOCAL loMailman LOCAL lnSuccess LOCAL loClientCert LOCAL loServerCert * The mailman object is used for receiving (POP3) * and sending (SMTP) email. loMailman = CreateObject('Chilkat.MailMan2') * Any string argument automatically begins the 30-day trial. lnSuccess = loMailman.UnlockComponent("30-day trial") IF (lnSuccess <> 1) THEN =MESSAGEBOX("Component unlock failed") QUIT ENDIF * Set the GMail account POP3 properties. loMailman.MailHost = "pop.gmail.com" loMailman.PopUsername = "chilkat.support" loMailman.PopPassword = "****" loMailman.PopSsl = 1 loMailman.MailPort = 995 * Use our certificate, which is already installed * in our current-user certificate store on the computer. loClientCert = CreateObject('Chilkat.Cert') lnSuccess = loClientCert.LoadByCommonName("Chilkat Software, Inc.") IF (lnSuccess <> 1) THEN =MESSAGEBOX(loClientCert.LastErrorText) QUIT ENDIF * 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. loMailman.SetSslClientCert(loClientCert) * Establish a POP3 connection: lnSuccess = loMailman.Pop3BeginSession() IF (lnSuccess <> 1) THEN =MESSAGEBOX(loMailman.LastErrorText) QUIT ENDIF * Let's look at the LastErrorText to see the details * of the successful connection. We should see our cert: ? loMailman.LastErrorText * OK, now examine the server's cert: loServerCert = loMailman.GetPop3SslServerCert() IF (loServerCert = NULL ) THEN =MESSAGEBOX("No server cert available.") ELSE ? "Server SSL certificate:" ? loServerCert.SubjectDN * Was the server certificate verified? * It's not necessarily an error if the SSL Server cert is not verified. IF (loMailman.Pop3SslServerCertVerified = 1) THEN ? "Server SSL certificate was verified." ELSE ? "Server SSL certificate was NOT verified!" ENDIF ENDIF |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2007 Chilkat Software, Inc. All Rights Reserved.
Mail Component · .NET Email Component · ASP Mail Component · XML Parser