使用c#asp.net的AspNetMx电子邮件验证 [英] AspNetMx Emaild Validation with c# asp.net
问题描述
我正在尝试aspNetMx API.我想知道以下数字.检查电子邮件是否有效.
I am trying the aspNetMx API. I would like to know the following figures. Checking the email is valid or invalid.
-
如果电子邮件有效(意味着域有效并且用户也存在)=>标记为有效(例如X)
If email is valid (means domain is valid and user also exists) => flag as valid (eg. X)
如果电子邮件无效,则=>标记为无效(例如Y)
If email is invalid, => flag as invalid (eg. Y)
2.1.这是由于电子邮件语法不正确(例如Y1)
2.1. which is due to bad email syntax (eg. Y1)
2.2.这是由于电子邮件域不正确(例如,Y2)
2.2. which is due to bad email domain (eg. Y2)
2.3是由于邮箱损坏(例如,Y3)
2.3 which is due to bad mailbox (eg. Y3)
以下是aspNetMX验证电子邮件地址的不同级别.
The following are different levels that aspNetMX validates the email addresses.
MXValidateLevel.NotValid
MXValidateLevel.Syntax
MXValidateLevel.MXRecords
MXValidateLevel.GreyListed
MXValidateLevel.SMTP
MXValidateLevel.Mailbox
此致
推荐答案
You should check the docs online : Taken from http://www.aspnetmx.com/help/index.htm
MXValidate mx = new MXValidate();
string email = "test@hotmail.com";
MXValidateLevel level = mx.Validate( email, MXValidateLevel.Mailbox );
switch( level )
{
case MXValidateLevel.NotValid:
//bad email address, remove from email address list
break;
case MXValidateLevel.Syntax:
//the email address is syntactically correct
break;
case MXValidateLevel.MXRecords:
//mx records were found, but for some reason
//the SMTP server couldn't be found
//save email for checking later, and see if SMTP servers fail again
break;
case MXValidateLevel.SMTP:
//able to connect to the mail server
//but mail server said email address was bad
//remove from list
break;
case MXValidateLevel.Greylisted:
//able to connect to the mail server
//but mail server said email address was greylisted
//for a later time.
//try back later
break;
case MXValidateLevel.Mailbox:
//the email address validated to the mail box `enter code here`level
//and the mail server will accept email for that address
break;
}
这篇关于使用c#asp.net的AspNetMx电子邮件验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!