VBScript Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

VBScript Examples

Bounced Mail
Bz2
Character Encoding
Digital Certificates
CSV
Digital Signatures
Email
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
PFX
RSA
S/MIME
SFTP
SMTP
Socket
Spider
SSH
SSH Key
SSH Tunnel
String
Tar
Upload
XML
XMP
Zip Compression
Self-Extractor

More Examples...
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
Byte Array
RSS
Atom
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

 

Read IMAP Email

Download 32-bit Chilkat IMAP ActiveX (.msi)

Download All 32-bit Chilkat ActiveX Components (.zip)

Download All 64-bit Chilkat ActiveX Components (.zip)

Demonstrates how to read email on an IMAP server.

' This example downloads and prints the From/Subject of all email from the
' INBOX of an IMAP user account.

' Note: Programming in VBScript is almost identical to programming
' in Visual Basic 6.0.  You may wish to review the additional VB6 IMAP example
' programs at http://www.example-code.com/vb/imap.asp

set imap = CreateObject("Chilkat.Imap")
success = imap.UnlockComponent("Anything for 30-day trial")
if success = 0 then
	MsgBox "Failed to unlock component"
	' ...
end if

' Connect to an IMAP server.
success = imap.Connect("mail.chilkatsoft.com")
if success = 0 then
	' Failed
	MsgBox imap.LastErrorText
	' ...
end if

' Login
success = imap.Login("myLogin", "myPassword")
if success = 0 then
	' Failed
	MsgBox imap.LastErrorText
	' ...
end if

success = imap.SelectMailbox("INBOX")
if success = 0 then
	' Failed
	MsgBox imap.LastErrorText
	' ...
end if

' Get the complete set of UIDs for all the emails in the mailbox.
useUids = 1
set msgSet = imap.Search("ALL",1)
if msgSet is Nothing then
	' Failed
	MsgBox imap.LastErrorText
	' ...
end if

' Fetch all the mail into a bundle object.
' To fetch entire emails, including attachments, call FetchBundle.
' To fetch headers only, call FetchHeaders.
'Set bundle = imap.FetchBundle(msgSet)
Set bundle = imap.FetchHeaders(msgSet)
if bundle is Nothing then
	' Failed
	MsgBox imap.LastErrorText
	' ...
end if

' Loop over the bundle and display the From and Subject.
s = ""
For i = 0 To bundle.MessageCount - 1
    Set email = bundle.GetEmail(i)
    s = s & email.From & ": " & email.Subject & vbCrLf
Next

MsgBox s

' Disconnect from the IMAP server.
' This example leaves the email on the IMAP server.
imap.Disconnect

 

© 2000-2010 Chilkat Software, Inc. All Rights Reserved.

Mail Component · XML Parser