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

Reading Unread POP3 Email

The POP3 protocol does not provide the ability to ask the server which emails are "unread". Furthermore, a pure POP3 server does not even keep this information. Some servers, such as Exchange Server, expose both POP3 and IMAP interfaces. In these cases, information about read/unread status exists on the server, but it is only available via the IMAP protocol. Email clients such as Outlook and Thunderbird keep read/unread information on the client computer. This example demonstrates how UIDLs can be saved to track and read "unread" email.

Download Chilkat Email ActiveX

LOCAL loMailman
LOCAL lnSuccess
LOCAL loSaSeenUidls
LOCAL loSaUidls
LOCAL loSaUnseenUidls
LOCAL i
LOCAL n
LOCAL loBundle
LOCAL loEmail

*  The mailman object is used for receiving (POP3)
*  and sending (SMTP) email.
loMailman = CreateObject('Chilkat.MailMan2')

*  Any string argument automatically begins the 30-day trial.

lnSuccess = loMailman.UnlockComponent("30-day trial")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX("Component unlock failed")
    QUIT
ENDIF

*  Set the POP3 server's hostname
loMailman.MailHost = "mail.chilkatsoft.com"

*  Set the POP3 login/password.
loMailman.PopUsername = "***"
loMailman.PopPassword = "***"

*  You may keep a list of already-seen UIDLs in a text file:
*  If this is the first time you're running this example,
*  create an empty text file named "seenUidls.txt"
loSaSeenUidls = CreateObject('Chilkat.CkStringArray')
lnSuccess = loSaSeenUidls.LoadFromFile("seenUidls.txt")
IF (lnSuccess <> 1) THEN
    =MESSAGEBOX("failed to load seenUidls.txt")
    QUIT
ENDIF

*  Get the complete list of UIDLs on the mail server.

loSaUidls = loMailman.GetUidls()

IF (loSaUidls = NULL ) THEN
    =MESSAGEBOX(loMailman.LastErrorText)
    QUIT
ENDIF

*  Create a new string array object (it's an object, not an actual array)
*  and add the UIDLs from saUidls that aren't already seen.
loSaUnseenUidls = CreateObject('Chilkat.CkStringArray')

n = loSaUidls.Count
FOR i = 0 TO n - 1
    IF (loSaSeenUidls.Contains(loSaUidls.GetString(i)) <> 1) THEN
        loSaUnseenUidls.Append(loSaUidls.GetString(i))
    ENDIF

NEXT

IF (loSaUnseenUidls.Count = 0) THEN
    =MESSAGEBOX("No unseen emails!")
    RELEASE loSaUidls
    QUIT
ENDIF

*  Download in full the unseen emails:

loBundle = loMailman.FetchMultiple(loSaUnseenUidls)
IF (loBundle = NULL ) THEN
    =MESSAGEBOX(loMailman.LastErrorText)
    RELEASE loSaUidls
    QUIT
ENDIF

FOR i = 0 TO loBundle.MessageCount - 1
    loEmail = loBundle.GetEmail(i)
    ? loEmail.From
    ? loEmail.Subject
    ? "----"
    RELEASE loEmail
NEXT

*  Save saUidls to "seenUidls.txt"
loSaUidls.SaveToFile("seenUidls.txt")

RELEASE loSaUidls

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

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