![]() |
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
(PowerBuilder) 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.
integer li_rc integer li_Success oleobject loo_Imap oleobject loo_EmailHeader oleobject loo_EmailFull integer li_Uid integer li_IsUid integer li_UidFromCkxHeader li_Success = 0 // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. loo_Imap = create oleobject li_rc = loo_Imap.ConnectToNewObject("Chilkat.Imap") if li_rc < 0 then destroy loo_Imap MessageBox("Error","Connecting to COM object failed") return end if // Connect to an IMAP server. // Use TLS loo_Imap.Ssl = 1 loo_Imap.Port = 993 li_Success = loo_Imap.Connect("imap.example.com") if li_Success = 0 then Write-Debug loo_Imap.LastErrorText destroy loo_Imap return end if // Login li_Success = loo_Imap.Login("***","***") if li_Success = 0 then Write-Debug loo_Imap.LastErrorText destroy loo_Imap return end if // Select an IMAP mailbox li_Success = loo_Imap.SelectMailbox("Inbox") if li_Success = 0 then Write-Debug loo_Imap.LastErrorText destroy loo_Imap return end if loo_EmailHeader = create oleobject li_rc = loo_EmailHeader.ConnectToNewObject("Chilkat.Email") loo_EmailFull = create oleobject li_rc = loo_EmailFull.ConnectToNewObject("Chilkat.Email") li_Uid = 2014 li_IsUid = 1 // Fetch only the email header li_Success = loo_Imap.FetchEmail(1,li_Uid,li_IsUid,loo_EmailHeader) if li_Success = 0 then Write-Debug loo_Imap.LastErrorText destroy loo_Imap destroy loo_EmailHeader destroy loo_EmailFull return end if // Now fetch the full email li_UidFromCkxHeader = loo_EmailHeader.GetImapUid() if li_UidFromCkxHeader < 0 then // Failed. Write-Debug "No ckx-imap-uid header was found." destroy loo_Imap destroy loo_EmailHeader destroy loo_EmailFull return end if li_Success = loo_Imap.FetchEmail(0,li_Uid,li_IsUid,loo_EmailFull) if li_Success = 0 then Write-Debug loo_Imap.LastErrorText destroy loo_Imap destroy loo_EmailHeader destroy loo_EmailFull return end if // OK, we have the full email, do whatever we want... // Disconnect from the IMAP server. li_Success = loo_Imap.Disconnect() destroy loo_Imap destroy loo_EmailHeader destroy loo_EmailFull |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.