First, add a service reference to the project.
--------------------------- Verify that the Email address is correct. aspx -----------------
Copy codeThe Code is as follows:
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> </title>
</Head>
<Body>
<Form id = "form1" runat = "server">
<Asp: ScriptManager ID = "ScriptManager1" runat = "server">
</Asp: ScriptManager>
<Asp: UpdatePanel ID = "UpdatePanel1" runat = "server">
<ContentTemplate>
<Div>
Email <asp: TextBox ID = "txtemail" runat = "server"> </asp: TextBox> <asp: Label ID = "lblinfo"
Runat = "server" Text = ""> </asp: Label>
<Br/>
<Br/>
<Asp: Button ID = "Button1" runat = "server" Text = "call" onclick = "button#click"/>
</Div>
</ContentTemplate>
</Asp: UpdatePanel>
</Form>
</Body>
</Html>
------------------ Verify that the Email address is correct. aspx. cs -----------------------
Copy codeThe Code is as follows:
Protected void button#click (object sender, EventArgs e)
{
WebEmail. ValidateEmailWebService webemail = new WebEmail. ValidateEmailWebService ();
Byte result = webemail. ValidateEmailAddress (txtemail. Text );
If (result = 0)
{
Lblinfo. Text = "Please verify again ";
}
Else if (result = 1)
{
Lblinfo. Text = "the email address is valid ";
}
Else if (result = 2)
{
Lblinfo. Text = "only the domain name is correct ";
}
Else if (result = 3)
{
Lblinfo. Text = "an unknown error ";
}
Else if (result = 4)
{
Lblinfo. Text = "the email server cannot be found ";
}
Else if (result = 5)
{
Lblinfo. Text = "Incorrect email address ";
}
Else if (result = 6)
{
Lblinfo. Text = "the number of free user verifications exceeds (50 times/24 hours )";
}
Else if (result = 7)
{
Lblinfo. Text = "commercial users cannot pass Verification ";
}
}