SmtpValidateEmailAddressSyntax Method |
Verifies if the specified string is a correctly formatted e-mail address.
Namespace: MailBee.SmtpMailAssembly: MailBee.NET (in MailBee.NET.dll) Version: 12.5.0 build 687 for .NET 4.5
Syntax public static bool ValidateEmailAddressSyntax(
string email
)
Public Shared Function ValidateEmailAddressSyntax (
email As String
) As Boolean
Parameters
- email
- Type: SystemString
The e-mail address string.
Return Value
Type:
Booleantrue if the syntax of the specified string is correct; otherwise,
false.
Remarks This method only checks the syntax of the e-mail address. It does NOT make any network connections and thus
does NOT actually check if this address exists and you can send e-mails there.
If you need further checks, you can use
TestSend(SendFailureThreshold) method.
To test bulk of e-mail addresses, consider using
EmailAddressValidator component.
Note |
---|
As this method is static, you do not need to create an instance of Smtp object in order to use it. |
Examples
This example returns
Correct syntax as
_mike.o'neil_loves_underscores@sub-domain.travel address is complex but still has valid syntax.
using MailBee.SmtpMail;
if (Smtp.ValidateEmailAddressSyntax("_mike.o'neil_loves_underscores@sub-domain.travel"))
{
Console.WriteLine("Correct syntax");
}
else
{
Console.WriteLine("Wrong syntax");
}
Imports MailBee.SmtpMail
If Smtp.ValidateEmailAddressSyntax("_mike.o'neil_loves_underscores@sub-domain.travel") Then
Console.WriteLine("Correct syntax")
Else
Console.WriteLine("Wrong syntax")
End If
See Also