Xbase++
Xbase++
Connecting to GMAIL using IMAP
Demonstrates how to connect to GMAIL using IMAP.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oImap
nSuccess := 0
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
oImap := CreateObject("Chilkat.Imap")
// Turn on session logging:
oImap:KeepSessionLog := 1
// Connect to GMail
// Use TLS
oImap:Ssl := 1
oImap:Port := 993
nSuccess := oImap:Connect("imap.gmail.com")
IF (nSuccess != 1)
? oImap:LastErrorText
oImap:destroy()
RETURN
ENDIF
// Login
// Your login is typically your GMail email address.
nSuccess := oImap:Login("username@gmail.com", "myPassword")
IF (nSuccess != 1)
? oImap:LastErrorText
oImap:destroy()
RETURN
ENDIF
// Select an IMAP mailbox
nSuccess := oImap:SelectMailbox("Inbox")
IF (nSuccess != 1)
? oImap:LastErrorText
oImap:destroy()
RETURN
ENDIF
// Show the session log.
? oImap:SessionLog
// Disconnect from the IMAP server.
nSuccess := oImap:Disconnect()
oImap:destroy()