电子邮件ID验证 [英] E-Mail ID validation

查看:158
本文介绍了电子邮件ID验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友,

我有一个文本框来获取电子邮件ID.
使用正常的Javascript验证,我可以检查输入的天气字符串是否为电子邮件ID.
但是是否有任何方法可以找到输入的天气电子邮件ID有效.
例如. test@testing.com
在正常验证中,它接受它作为电子邮件ID.
实际上,没有这样的域和电子邮件.
如果有这样的建议,是否可以找到它.

Dear Friends,

I ve a text box to get E-Mail ID.
Using normal Javascript validation I can check weather entered string is email id or not.
But is there any option to find weather entered email id is valid one.
Eg. test@testing.com
In normal validation, It accept it as Email ID.
In real, there is no domain and email like this.
Is there any option to find it, if so kindly suggest.

推荐答案

否.找出答案的唯一方法是将电子邮件发送到该地址,然后查看是否收到回复.

这就是为什么如此多的系统发送注册完成消息的原因,该消息要求用户点击链接以完成注册-它确认在发送电子邮件时 有效,并在实际用户的控制下.

即使如此,几分钟后,它仍可能不是有效地址-
No. The only way to find out is to send an email to the address and see if you get a response.

That is why so many systems send a registration completion message, which requires the user to follow a link to complete registration - it confirms that at the time of sending the email address was valid, and under the control of the actual user.

Even then, a couple of minutes later it may not be a valid address - 10 Minute Mail[^]

[edit]Whole bunch of typos... - OriginalGriff[/edit]


没有语言支持这种验证,恕我直言,它永远不应该.
NO language supports this kind of validation and IMHO it never should.


基本上可以分配解决方案1.但是为什么要等待10分钟?您可以使用ping命令检查所提供的域是否有效.

为此,您可能需要两件事,

1. Internet连接(到ping).
2.无论您是否响应,都会返回一个小函数.

Basically you can adpot solution 1. But why to wait for 10 mins ? you can use the ping command to check wether the provided domain is a valid one or not.

for this you might need 2 things,

1. Internet Connection (to ping).
2. A small function which will return, wehther you got a response or not.

public static bool IsConnectedToInternet
{
    get
    {
        //  Split email id and get domain name.
        Uri url = new Uri("www.testing.com"); // as per your example
        string pingurl = string.Format("{0}", url.Host);
        string host = pingurl;
        bool result = false;
        Ping p = new Ping();
        try
        {
            PingReply reply = p.Send(host, 3000);
            if (reply.Status == IPStatus.Success)
                return true;
        }
        catch { }
        return result;
    }
}



PING向服务器发送ICMP(Internet控制消息协议)回显请求,并等待接收回显.如果状态"的值为成功,则PingReply成功.



The PING sends an ICMP (Internet Control Message Protocol) echo request to the server and waits to receive the echo back. If the value of Status is success, the PingReply is successful.


这篇关于电子邮件ID验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆