Catalyst Internet Mail .NET

InternetMail.GetHeader Method (String, String)

Return the value of a header field in the current message part.

[Visual Basic]
Overloads Public Function GetHeader( _
   ByVal headerName As String, _
   ByRef headerValue As String _
) As Boolean
[C#]
public bool GetHeader(
   string headerName,
   ref string headerValue
);

Parameters

headerName
A string which specifies the name of the header field.
headerValue
A string passed by reference which will contain the value of the header field when the method returns.

Return Value

This method returns a boolean value. If the method succeeds, the return value is true. If the method fails, the return value is false. To get extended error information, check the value of the LastError property.

Remarks

The GetHeader method is used to retrieve the value for a specific header in the current message part. If the header field exists, the method will return true and the headerValue argument will contain the header value. If the header does not exist, the method will return false.

If there are multiple headers with the same name, the first value will be returned. To enumerate all of the headers in a message, including duplicate header fields, use the GetFirstHeader and GetNextHeader methods.

The current message part is returned by the Part property.

See Also

InternetMail Class | SocketTools Namespace | InternetMail.GetHeader Overload List