org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Unknown SMTP host: smtp.qq.com;
QQ邮箱设置了smtp服务
public void sendMail() { mailSender = new JavaMailSenderImpl(); mailSender.setHost("smtp.qq.com"); mailSender.setPort(25); mailSender.setUsername("[email protected]"); mailSender.setPassword("XXXXXX"); SimpleMailMessage smm = new SimpleMailMessage(); // 设定邮件参数 smm.setFrom(mailSender.getUsername()); smm.setTo("[email protected]"); smm.setSubject("Hello world"); smm.setText("Hello world via spring mail sender"); // 发送邮件 mailSender.send(smm);
}
求大神指点啊!!!!!
什么意思?1810499244我QQ