Could not connect to SMTP host: smtp.exmail.qq.com, port: 25;解决方法

Could not connect to SMTP host: smtp.exmail.qq.com, port: 25;解决方法:

记得setSsl(true);我把端口号设置成了587
email.setHostName(hostName);
email.setSSL(true);

email.setSslSmtpPort(sslSmtpPort);
email.setFrom(mailbox, mailbox);

email.setAuthentication(mailbox, password);
email.setSubject(title);
email.setMsg(body);
email.setCharset(charset);
email.attach(att1);

//添加收件人
for (int i = 0; i < sendAddress.length; i++) {
address = sendAddress[i];
email.addTo(address);
}
//添加抄送人
if (bcc_Address != null) {
for (String bcc: bcc_Address) {
email.addCc(bcc);
}
}
email.send();

你可能感兴趣的:(HtmlEmail)