MimeParseAddress
INT MimeParseAddress(
LPCTSTR lpszString,  
LPCTSTR lpszDomain,  
LPTSTR lpszAddress,  
INT nMaxLength  
);

The MimeParseAddress function parses a string for an email address, copying the address to the specified buffer.

Parameters

lpszString
A pointer to a null-terminated string which contains the email address to parse.
lpszDomain
A pointer to a null-terminated string which specifies a default domain for the address. This parameter may be NULL or point to an empty string if no default domain is required.
lpszAddress
A pointer to a string buffer which will contain the parsed email address when the function returns. It is recommended that this buffer be at least 128 characters in length.
nMaxLength
The maximum number of characters which can be copied into the string buffer, including the terminating null byte.

Return Value

If the function succeeds, the return value is the length of the address. If the function fails, the return value is MIME_ERROR. To get extended error information, call MimeGetLastError.

Remarks

The MimeParseAddress function 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 used is as follows:

"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 MimeParseAddress function recognizes both formats, and when passed either string, would return the following address:

user@domain.com

If there was no domain specified in the address, that is just a user name was specified, then the value the lpszDomain parameter is added to the address.

Requirements

Client: Requires Windows Vista, Windows XP or Windows 2000 Professional.
Server: Requires Windows Server 2008, Windows Server 2003 or Windows 2000 Server.
Header: Include cstools6.h.
Library: Use csmsgav6.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

MimeExportMessage, MimeExtractFile, MimeImportMessage


Copyright © 2008 Catalyst Development Corporation. All rights reserved.