![]() |
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
(VBScript) Iterate Email HeadersDemonstrates how to iterate over the email header fields.
Dim fso, outFile Set fso = CreateObject("Scripting.FileSystemObject") 'Create a Unicode (utf-16) output text file. Set outFile = fso.CreateTextFile("output.txt", True, True) ' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Email") set email = CreateObject("Chilkat.Email") ' 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 = email.LoadEml("testReceivedHdrs.eml") If (success <> 1) Then outFile.WriteLine(email.LastErrorText) WScript.Quit End If ' How many header fields? n = email.NumHeaderFields If (n > 0) Then ' Display the name and value of each header: For i = 0 To n - 1 name = email.GetHeaderFieldName(i) value = email.GetHeaderFieldValue(i) outFile.WriteLine(i) outFile.WriteLine(name) outFile.WriteLine(value) Next End If outFile.Close |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.