Parse an Internet e-mail address.
Syntax
object.ParseAddress( Address )
The ParseAddress method syntax has the following
parts:
| Part |
Description |
| object
|
An object expression that
evaluates to an InternetMail object. |
| address
|
A string which specifies the
address to be parsed. |
Return Type
String
Remarks
The ParseAddress method parses a string which contains an
e-mail address and returns only the address portion, excluding any
comments. An address may contain comments enclosed in parenthesis,
or may specify a name along with the address in which case the
address is enclosed in angle brackets. For example, consider the
following header field value:
"User Name" <user@domain.com> (This is a
comment)
The ParseAddress method would return "user@domain.com" if
passed the above string, removing the name and any comments.
Note that the ParseAddress method will only parse a
single address. If multiple addresses are specified, they must be
comma delimited and split prior to calling this method.
Example
The following example parses all of the recipient e-mail
addresses in the current message, storing them in the
strAddresses string array.
Dim strAddresses() As String, strAddress As String
Dim nIndex As Integer, nAddresses As Integer
nAddresses = 0
strAddresses = Split(InternetMail1.To & "," & _
InternetMail1.Cc & "," & _
InternetMail1.Bcc, ",")
For nIndex = 0 To UBound(strAddresses)
If Len(Trim(strAddresses(nIndex))) > 0 Then
strAddress = InternetMail1.ParseAddress(strAddresses(nIndex))
If Len(strAddress) > 0 Then
strAddresses(nAddresses) = strAddress
nAddresses = nAddresses + 1
End If
End If
Next
|