使用Javamail实现邮件发送异常怎么解决

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);
}

求大神指点啊!!!!!

邮箱

POP3服务器(端口995)
qq.com pop.qq.com
SMTP服务器(端口465或587)

smtp.qq.com

端口?追问

什么意思?1810499244我QQ

温馨提示:答案为网友推荐,仅供参考
相似回答