JavaMail后台显示发送成功,却收不到邮件
// TODO Auto-generated method stub
Properties props = new Properties();
//身份验证
props.setProperty("mail.smtp.auth", "true");
props.setProperty("mail.transport.protocol", "smtp");
//新浪的邮件服务器给发邮件
props.setProperty("mail.host", "smtp.sina.com");
Session session = Session.getInstance(props,
//进行认证
new Authenticator()
{
protected PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication("hbbddxzhj","6863120zhang");
}
}
);
session.setDebug(true);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("hbbddxzhj@sina.com"));
msg.setSubject("中文主题");
msg.setRecipients(RecipientType.TO,
InternetAddress.parse("hbbddxzhj@sina.com,hbbdzhj@sohu.com"));
msg.setContent("<span style='color:red'>中文呵呵呵</span>", "text/html;charset=gbk");
Transport.send(msg);
后台打印出的调试数据也正常,就是收不到邮件