SocketTools .NET Edition

InternetMail.ParseAddress Method (String, String)

Parse an Internet email address.

[Visual Basic]
Overloads Public Function ParseAddress( _
   ByVal mailAddress As String, _
   ByRef parsedAddress As String _
) As Boolean
[C#]
public bool ParseAddress(
   string mailAddress,
   ref string parsedAddress
);

Parameters

mailAddress
A string which specifies the email address to be parsed.
parsedAddress
A string passed by reference which will contain the parsed email address.

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 ParseAddress method is useful for parsing the email addresses that may be specified in various header fields in the message. In many cases, the addresses have additional comment characters which are not part of the address itself. For example, one common format is "User Name" <user@domain.com>. In this case, the email address is enclosed in angle brackets and the name outside of the brackets is considered to be a comment which is not part of the address itself.

Another common format is user@domain.com (User Name). In this case, there is the address followed by a comment which is enclosed in parenthesis. The ParseAddress method recognizes both formats, and when passed either string, would return the address user@domain.com.

See Also

InternetMail Class | SocketTools Namespace | InternetMail.ParseAddress Overload List