Java发送邮件
public static void send() {
SimpleEmail email = new SimpleEmail();
email.setTLS(true);
email.setHostName("smtp.qq.com");
email.setAuthentication("邮箱地址", "授权码"); // 邮箱地址和授权码
try {
email.addTo("accept@qq.com"); // 接收方
email.setFrom("send@qq.com"); // 发送方
email.setSubject("Java Mail Test"); // 标题
email.setMsg("Just a simple send test ."); // 内容
email.send();
} catch (EmailException e) {
e.printStackTrace();
}
}