【发布时间】:2013-08-13 22:15:23
【问题描述】:
我正在尝试在 java 中发送邮件,但我不断收到此错误“com.sun.mail.smtp.SMTPSendFailedException: 550 failed to meet SPF requirements”,我已经在互联网上搜索是否有其他人遇到过这个问题java,什么也没找到。任何人都知道这个错误意味着什么?我发送电子邮件的代码如下。
//Create session and message
Properties props = System.getProperties();
props.put("mail.smtp.user", user);
props.put("mail.smtp.password", password);
props.put("mail.smtp.auth", "false");
props.put("mail.smtp.host", mailhost);
javax.mail.Authenticator auth = null;
auth = new javax.mail.Authenticator() {
@Override
public javax.mail.PasswordAuthentication getPasswordAuthentication() {
return new javax.mail.PasswordAuthentication(user, password);
}
};
session = Session.getInstance(props, auth);
Message msg = new MimeMessage(session);
//Set from,recipients,content and other stuff here
//...................
//Send the message
Transport.send(msg);
【问题讨论】:
-
哪个 SMTP 服务器和目标服务器有问题?有些需要专门的密码验证。
标签: java email tomcat smtp jakarta-mail