ValidateEmailAddress Method
Tests whether specified email address is correct.
This address must be "pure", i.e. without friendly names or comments.
To get pure email address of the sender use PureFromAddr
property.
The method checks email address syntax and optionally performs simple DNS query
to check whether email address domain (the part after "@" symbol)
is a valid email domain.
Note: It's strongly recommended that you explicitly
specify DNS server name in DNSServer parameter. Although this
parameter can be autodetected from Windows, the Windows API functions used for
this can produce memory or resource leaks in certain installations.
blnResult = ObjectName.ValidateEmailAddress(EmailAddress, [Options]) |
Parameters: | ||
EmailAddress As String | Email address to check. E.g. "user@server.com" or "info@[127.0.0.1]". | |
Options As Long | (optional) Specifies email address
validation level. Higher level requires more time to execute. Options supported:
|
|
DNSServer As String | (optional) Specifies DNS server name to be used for resolving host names into IP addresses. | |
Return value As Boolean | True if email address seems to be correct. False if email address is invalid or can not be validated (DNS server failed, etc.) | |
Remarks: | There is no 100% guarantee that email address is correct even if its syntax is OK and the domain exists. The only reliable way to validate email address is to send email to this address and then check whether bounce mail returned for this address |
Usage example:
Dim Msg, dDateTime 'Using visual basic to create object Set Msg = CreateObject("MailBee.Message") 'Using ASP to create object 'Set Msg = Server.CreateObject("MailBee.Message") 'In ASP use Response.Write instead of MsgBox If Msg.ValidateEmailAddress("abc@pbox.server.com", 1) Then MsgBox "Email address seems to be valid" Else MsgBox "Email address is invalid or cannot be checked" End If
See Also:
PureFromAddr
Property
PureToAddr Property
PureCCAddr Property
Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.