1.相关代码:
public static void sendSSLMessage(String hostName, int port, String username, String password, String subject, String massage, String ... to) throws EmailException {
Email email = new SimpleEmail();
email.setCharset("UTF-8");
email.setHostName(hostName);
email.setSmtpPort(port);
email.setSSLOnConnect(true);
email.setAuthenticator(new DefaultAuthenticator(username, password));
email.setFrom(username);
email.addTo(to);
email.setSubject(subject);
email.setMsg(massage);
email.send();
}
2.截图:
3.有多个收件人,只显示一个,163邮箱能显示多个,阿里企业邮箱只显示一个