从数据库中获取有效的电子邮件ID [英] fetch valid email id from database

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

问题描述

嗨朋友........





我有一个问题,我不知道如何解决那个问题。



我的问题是......



在我的数据库中,我有有效的电子邮件ID和无效的电子邮件ID。

如何使用C#

Hi friends........


I have one question and I dont have any idea how to solve that question.

My question is......

In my database,I have valid email id and invalid email id.
How to fetch valid email id from database using C#

推荐答案

从数据库中获取有效的电子邮件ID:下次尝试:



点击我! [ ^ ]
Try this next time:

Click me![^]


除了首先查看它并查看它是否符合电子邮件地址规则 [ ^ ]然后发送电子邮件,看看你是否得到了响应。



即使是外观漂亮的电子邮件地址(从某种意义上来说,它是完整的,并且符合此类地址的规则),例如xxx@xxx.xxx可以被发送到,但它不是一个有效的电子邮件地址,因为在另一端有一个消息框,或者如果有的话,有人阅读它。唯一的方法是发送电子邮件,看看你是否收到回复 - 如果你这样做,那么这是一个有效的电子邮件地址。



这并不意味着它在您收到回复后立即就是一个有效的电子邮件地址 - 有些地方提供有效的电子邮件地址,总共持续十分钟例如。
You can''t tell if an email address read from your database is valid or not except by first looking at it and seeing if it conforms to the rules for emails addresses[^] and then sending it an email and seeing if you get a response.

Even a "good looking" email address (in the sense that it is well formed and conforms to the rules for such addresses) such as xxx@xxx.xxx can be sent to, but it is not a "valid" email address in that there is either a message box at the other end, or a human being to read it if there was. The only way to tell is to send an email and see if you get a response - if you do, it is a valid email address at that moment.

That does not mean it is a valid email address immediately after you have received the response - there are places which provide valid email addresses which last a total of ten minutes for example.


亲爱的以下方法,您可以完成工作



1.读取数据表中的所有电子邮件ID



2.使用以下方法检查电子邮件是否有效



Dear by the following method you can get your work done

1. Read all email-ID in a datatable

2. use the following method to check ifthe email is valid

//suppose datatable name is dt

if(dt.Rows[0]["Email"].toString().indexOf("@")>0) 
{

string emailPart=dt.Rows[0]["Email"].toString().SubString(dt.Rows[0]["Email"].toString().indexOf("@"),dt.Rows[0]["Email"].toString().Length-dt.Rows[0]["Email"].toString().indexOf("@"));

if(emailPart.IndexOf(".")>0)
{

//display the email in your textBox
}
}





我猜它解决了你的问题。如果它不是



I guess it solves your problem. Do let me know if it dosen''t


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

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