VBScript Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++DelphiFoxProJavaPerlPythonRubySQL ServerVBScript

VBScript Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
PFX
RSA Encryption
S/MIME
Socket
Spider
String
Tar
Upload
XML
XMP
Zip Compression
Self-Extractor

More Examples...
Email Object
POP3
SMTP
Byte Array
RSS
Atom

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

 

SSL POP3 with Certificates

Demonstrates 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.

Download Chilkat Email ActiveX

Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set outFile = fso.CreateTextFile("output.txt", True)

'  The mailman object is used for receiving (POP3)
'  and sending (SMTP) email.
set mailman = CreateObject("Chilkat.MailMan2")

'  Any string argument automatically begins the 30-day trial.
success = mailman.UnlockComponent("30-day trial")
If (success <> 1) Then
    MsgBox "Component unlock failed"
    WScript.Quit
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 = CreateObject("Chilkat.Cert")
success = clientCert.LoadByCommonName("Chilkat Software, Inc.")
If (success <> 1) Then
    MsgBox clientCert.LastErrorText
    WScript.Quit
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
    MsgBox mailman.LastErrorText
    WScript.Quit
End If

'  Let's look at the LastErrorText to see the details
'  of the successful connection.  We should see our cert:
outFile.WriteLine(mailman.LastErrorText)

'  OK, now examine the server's cert:

Set serverCert = mailman.GetPop3SslServerCert()
If (serverCert Is Nothing ) Then
    MsgBox "No server cert available."
Else
    outFile.WriteLine("Server SSL certificate:")
    outFile.WriteLine(serverCert.SubjectDN)

    '  Was the server certificate verified?
    '  It's not necessarily an error if the SSL Server cert is not verified.
    If (mailman.Pop3SslServerCertVerified = 1) Then
        outFile.WriteLine("Server SSL certificate was verified.")
    Else
        outFile.WriteLine("Server SSL certificate was NOT verified!")
    End If

End If


outFile.Close

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

© 2003-2007 Chilkat Software, Inc. All Rights Reserved.

Mail Component · XML Parser