通过javamail 验证邮箱是否有效

int port = value;
String host =value;
String user = value;
String pwd = value;
try {
    Properties props = new Properties();
    props.put("mail.smtp.host", host);
    props.put("mail.smtp.starttls.enable","true");
    props.put("mail.smtp.auth", "false");
    Session session = Session.getInstance(props);
    Transport transport = session.getTransport("smtp");
    transport.connect(host, port, user, pwd);
    transport.close();
    return true;
}
catch(Exception e) {
     e.printStackTrace();
}

你可能感兴趣的:(javamail)