验证是否存在电子邮件地址

时间:2012-11-10 05:42:17

标签: android email email-verification

我成功完成了validation of mail address,但我想要一些验证电子邮件地址的建议。重点是当用户输入电子邮件ID时,应该检查它是真实的还是只是假身份证。 有什么建议吗?

4 个答案:

答案 0 :(得分:1)

不,这个设施不可用。您只有在拥有自己的邮件服务器时才能验证您是否有权检查邮件ID是否有效。或者当您拥有其他服务器时,您可以获得所有其他邮件服务器的镜像,然后您才能验证,因此,如果您只是邮件ID的用户,那么您可以验证邮件ID是否有效。 / p>

您只能通过模式检查来验证邮件ID的正确格式。

玩得开心

答案 1 :(得分:1)

您只能使用regular expression检查是否输入E-mail id is validate or not,无法检查id是否存在?据我所知。

查看此link已经得到很好的回答

答案 2 :(得分:0)

public static void main(String[] args) throws Exception {
 String email = null;
 String dns = null;

 BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter email address to validate: ");
email = reader.readLine();
System.out.print("Enter DNS hostname to perform domain validation (e.g. ns.myhost.com): ");
dns = reader.readLine();
// create EmailInspector instance
EmailInspector inspector = new EmailInspector();

// enable debugging
inspector.setDebug(true);

// set DNS server
inspector.setNameserver(dns);

// set validation level
inspector.setEmailInspectionLevel(inspector.DOMAIN_VALIDATION);

// validate email
inspector.validate(email);
}

}






 .  Create new EmailInspector instance.
    .  Enable debugging.
    .  Set DNS server to be used for looking up domains.
    .  Set validation level.
    .  Validate email address.

答案 3 :(得分:0)

Properties props = System.getProperties();

    props.put("mail.smtp.user", senderEmail);
    props.put("mail.smtp.host", "smtp.gmail.com");
    props.put("mail.smtp.port", "465");
    props.put("mail.smtp.starttls.enable", "true");
    props.put("mail.smtp.debug", "true");
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.socketFactory.port", "465");
    props.put("mail.smtp.socketFactory.class", 
          "javax.net.ssl.SSLSocketFactory");
    props.put("mail.smtp.socketFactory.fallback", "false");

    // Required to avoid security exception.
    email.MyAuthenticator authentication = 
          new email.MyAuthenticator(senderEmail,senderMailPassword);
    Session session = 
          Session.getDefaultInstance(props,authentication);
    session.setDebug(true);
相关问题