Sample code for 30+ languages & platforms
VBScript

Explicitly Connect to the POP3 Server

See more POP3 Examples

Demonstrates the Chilkat MailMan.Pop3Connect method, which explicitly connects to the POP3 server. If SSL/TLS is required by the current property settings, the secure TLS channel is established as part of connecting. This example opens the connection.

Background: Pop3Connect performs just the connect (and TLS handshake) step, without authenticating. Separating it from Pop3Authenticate gives explicit control over the session lifecycle and makes it easy to tell a connection failure apart from a login failure. For routine mailbox operations you don't need it — methods like CheckMail connect automatically.

Chilkat VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

'  Demonstrates the MailMan.Pop3Connect method, which explicitly connects to the POP3 server.
'  If SSL/TLS is required by the current property settings, the secure channel is established
'  as part of connecting.

set mailman = CreateObject("Chilkat.MailMan")

'  Configure the POP3 server connection.
mailman.MailHost = "pop.example.com"
mailman.MailPort = 995
mailman.PopSsl = 1

'  Explicitly connect to the POP3 server (does not authenticate).

success = mailman.Pop3Connect()
If (success = 0) Then
    outFile.WriteLine(mailman.LastErrorText)
    WScript.Quit
End If

outFile.WriteLine("Connected to the POP3 server.")

outFile.Close