Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
|
Fetch Oldest/Newest IMAP EmailEmails 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.
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