SocketTools .NET Edition

MailMessage.FindMessage Method (Int32, String, String, MimeSearch)

Search for a message in the current message store.

[Visual Basic]
Overloads Public Function FindMessage( _
   ByVal messageIndex As Integer, _
   ByVal headerField As String, _
   ByVal headerValue As String, _
   ByVal searchOptions As MimeSearch _
) As Integer
[C#]
public int FindMessage(
   int messageIndex,
   string headerField,
   string headerValue,
   MimeSearch searchOptions
);

Parameters

messageIndex
An integer value which specifies the message number that should be used when starting the search.
headerField
A string which specifies the name of the header field that should be searched. The header field name is not case sensitive.
headerValue
A string which specifies the header value that should be searched for. The search options can be used to specify if the search is case-sensitive, and whether the search should return partial matches to the string.
searchOptions
A MimeSearch enumeration which specifies the options to be used when searching for a message.

Return Value

An integer value which specifies the message index for the message that matched the search criteria. If no matching message was found, this method will return zero.

Remarks

The FindMessage method is used to search the message store for a message which matches a specific header field value. For example, it can be used to find every message which is addressed to a specific recipient or has a subject which matches a particular string value.

When searching for specific email addresses, it is recommended that you use the searchPartialMatch option because of the different ways that addresses can be annotated.

See Also

MailMessage Class | SocketTools Namespace | MailMessage.FindMessage Overload List