FoxPro Examples

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

Visual FoxPro Examples

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

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

 

Non-Chilkat Links
Text and String Handling

Fetch Oldest/Newest IMAP Email

Emails may be downloaded by sequence number. Assuming the selected mailbox is not empty, the oldest email is at sequence number 1, and the newest email is at sequence number N. The FetchSingle method may be used to download by sequence number.

Download 32-bit Chilkat IMAP ActiveX (.msi)

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

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

LOCAL loImap
LOCAL lnSuccess
LOCAL n
LOCAL lnIsUid
LOCAL loOldestEmail
LOCAL loNewestEmail

loImap = CreateObject('Chilkat.Imap')

*  Anything unlocks the component and begins a fully-functional 30-day trial.
lnSuccess = loImap.UnlockComponent("Anything for 30-day trial")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loImap.LastErrorText)
    QUIT
ENDIF

*  Connect to an IMAP server.
lnSuccess = loImap.Connect("mail.testemail.net")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loImap.LastErrorText)
    QUIT
ENDIF

*  Login
lnSuccess = loImap.Login("***","***")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loImap.LastErrorText)
    QUIT
ENDIF

*  Select an IMAP mailbox
lnSuccess = loImap.SelectMailbox("Inbox")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX(loImap.LastErrorText)
    QUIT
ENDIF

*  After selecting a mailbox, the NumMessages property
*  contains the number of emails in the selected mailbox.

n = loImap.NumMessages

IF (n > 0) THEN

    *  The oldest email is always at sequence number 1.

    lnIsUid = 0

    loOldestEmail = loImap.FetchSingle(1,lnIsUid)
    IF (NOT (loOldestEmail = NULL )) THEN

        *  Display the From and Subject
        ? loOldestEmail.FromAddress
        ? loOldestEmail.Subject

        ? "--"
        RELEASE loOldestEmail
    ENDIF

    *  The newest email is at sequence number N:

    loNewestEmail = loImap.FetchSingle(n,lnIsUid)
    IF (NOT (loNewestEmail = NULL )) THEN

        *  Display the From and Subject
        ? loNewestEmail.FromAddress
        ? loNewestEmail.Subject

        RELEASE loNewestEmail
    ENDIF

ENDIF

*  Disconnect from the IMAP server.
loImap.Disconnect()

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

Mail Component · .NET Email Component · ASP Mail Component · XML Parser