Classic ASP
Classic ASP
Connecting to GMAIL using IMAP
Demonstrates how to connect to GMAIL using IMAP.Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
set imap = Server.CreateObject("Chilkat.Imap")
' Turn on session logging:
imap.KeepSessionLog = 1
' Connect to GMail
' Use TLS
imap.Ssl = 1
imap.Port = 993
success = imap.Connect("imap.gmail.com")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( imap.LastErrorText) & "</pre>"
Response.End
End If
' Login
' Your login is typically your GMail email address.
success = imap.Login("username@gmail.com","myPassword")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( imap.LastErrorText) & "</pre>"
Response.End
End If
' Select an IMAP mailbox
success = imap.SelectMailbox("Inbox")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( imap.LastErrorText) & "</pre>"
Response.End
End If
' Show the session log.
Response.Write "<pre>" & Server.HTMLEncode( imap.SessionLog) & "</pre>"
' Disconnect from the IMAP server.
success = imap.Disconnect()
%>
</body>
</html>