GetHeader Method


Returns value of specified message header (or empty string if there is no such header in the message).


strHeaderValue = ObjectName.GetHeader(HeaderName)
 
Parameters:  
HeaderName As String name of message header (case is not significant, i.e. "X-Mailer" and "x-mailer" are equal)  
Return value As String String containing value of specified message header (or zero-length string if the header is not found)  
Remarks: You may use this method to get values for some rarely used headers not accessible through standard properties of Message object (standard properties are Subject, FromAddr, Date, ReplyTo, Received, and some others).

Usage example:

Dim Mailer, Msg
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.POP3")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.POP3")
'In ASP use Response.Write instead of MsgBox
Mailer.LicenseKey = "put your license key here"
Mailer.Connect "mailserver.com", 110, "MyName", "MyPassword"
If Mailer.Connected Then
   If Mailer.MessageCount > 0 Then
      Set Msg = Mailer.RetrieveSingleMessage(1)
      If Not Msg Is Nothing Then
        MsgBox "X-Mailer: " & Msg.GetHeader("X-Mailer")
      End If ' If the message does not have this header, empty string will be displayed
   End If
   Mailer.Disconnect
End If

See Also:

Message Object


Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.