如何检查电子邮件ID是否存在于域中,而不使用java发送任何邮件 [英] how to check that the email id exist in domain without sending any mails using java

查看:173
本文介绍了如何检查电子邮件ID是否存在于域中,而不使用java发送任何邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有以下功能:只检查有效的域名,但是我有需要检查域中的有效电子邮件地址,而不发送任何邮件。

  public boolean isValidEmailAddress(String email){
boolean result = true;

try {
InternetAddress emailAddr = new InternetAddress(email);
emailAddr.validate();

} catch(AddressException ex){
result = false;
}
返回结果;
}


解决方案

这是一个源代码可以做许多类型的验证,我一直在使用它多年:



http://www.rgagnon.com/javadetails/java-0452.html



注意:请参阅函数isAddressValid()在页面中进行完整验证。


Is there any way to verify where the email id exist in domain or not?

I am having the following function: it checks only for valid domain, but i need to check for valid email address in domain without sending any mails.

 public boolean isValidEmailAddress(String email) {
   boolean result = true;

   try {
      InternetAddress emailAddr = new InternetAddress(email);
      emailAddr.validate();

   } catch (AddressException ex) {
      result = false;
   }
   return result;
}

解决方案

Here is a source code that could do many type of verification, I've been using it for years :

http://www.rgagnon.com/javadetails/java-0452.html

Note : see the function isAddressValid() in the page for full validation.

这篇关于如何检查电子邮件ID是否存在于域中,而不使用java发送任何邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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