![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Visual FoxPro) Fetch Full Email Given Email HeaderWhen you fetch email headers using UIDs instead of sequence numbers, the email object (which includes only the header) will have auto-generated
The Chilkat Email object offers a Note: This example requires Chilkat v11.0.0 or greater.
LOCAL lnSuccess LOCAL loImap LOCAL loEmailHeader LOCAL loEmailFull LOCAL lnUid LOCAL lnIsUid LOCAL lnUidFromCkxHeader lnSuccess = 0 * This example requires the Chilkat API to have been previously unlocked. * See Global Unlock Sample for sample code. loImap = CreateObject('Chilkat.Imap') * Connect to an IMAP server. * Use TLS loImap.Ssl = 1 loImap.Port = 993 lnSuccess = loImap.Connect("imap.example.com") IF (lnSuccess = 0) THEN ? loImap.LastErrorText RELEASE loImap CANCEL ENDIF * Login lnSuccess = loImap.Login("***","***") IF (lnSuccess = 0) THEN ? loImap.LastErrorText RELEASE loImap CANCEL ENDIF * Select an IMAP mailbox lnSuccess = loImap.SelectMailbox("Inbox") IF (lnSuccess = 0) THEN ? loImap.LastErrorText RELEASE loImap CANCEL ENDIF loEmailHeader = CreateObject('Chilkat.Email') loEmailFull = CreateObject('Chilkat.Email') lnUid = 2014 lnIsUid = 1 * Fetch only the email header lnSuccess = loImap.FetchEmail(1,lnUid,lnIsUid,loEmailHeader) IF (lnSuccess = 0) THEN ? loImap.LastErrorText RELEASE loImap RELEASE loEmailHeader RELEASE loEmailFull CANCEL ENDIF * Now fetch the full email lnUidFromCkxHeader = loEmailHeader.GetImapUid() IF (lnUidFromCkxHeader < 0) THEN * Failed. ? "No ckx-imap-uid header was found." RELEASE loImap RELEASE loEmailHeader RELEASE loEmailFull CANCEL ENDIF lnSuccess = loImap.FetchEmail(0,lnUid,lnIsUid,loEmailFull) IF (lnSuccess = 0) THEN ? loImap.LastErrorText RELEASE loImap RELEASE loEmailHeader RELEASE loEmailFull CANCEL ENDIF * OK, we have the full email, do whatever we want... * Disconnect from the IMAP server. lnSuccess = loImap.Disconnect() RELEASE loImap RELEASE loEmailHeader RELEASE loEmailFull |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.