Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Delphi DLL) Iterate Email HeadersDemonstrates how to iterate over the email header fields.
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Email; ... procedure TForm1.Button1Click(Sender: TObject); var email: HCkEmail; success: Boolean; n: Integer; i: Integer; name: PWideChar; value: PWideChar; begin email := CkEmail_Create(); // First, load an email from a file. // Note: an email object may be loaded from a file, or // downloaded directly from a POP3 or IMAP server... success := CkEmail_LoadEml(email,'testReceivedHdrs.eml'); if (success <> True) then begin Memo1.Lines.Add(CkEmail__lastErrorText(email)); Exit; end; // How many header fields? n := CkEmail_getNumHeaderFields(email); if (n > 0) then begin // Display the name and value of each header: for i := 0 to n - 1 do begin name := CkEmail__getHeaderFieldName(email,i); value := CkEmail__getHeaderFieldValue(email,i); Memo1.Lines.Add(IntToStr(i)); Memo1.Lines.Add(name); Memo1.Lines.Add(value); end; end; CkEmail_Dispose(email); end; |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.