JavaMail 1.4.3 通过 Exchange 2003 发送邮件
我不断收到 550 5.7.1 无法中继 [电子邮件受保护]
尝试{ 属性 p = System.getProperties();
p.put("mail.smtp.host", "server IP");
p.put("mail.smtp.port", "25");
p.put("mail.debug", "true");
Session s = Session.getDefaultInstance(p);
Message msg = new MimeMessage(s);
msg.setFrom(new InternetAddress(from));
msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
msg.setSubject(subject);
Multipart mp = new MimeMultipart();
BodyPart bp = new MimeBodyPart();
bp.setText(message);
mp.addBodyPart(bp);
msg.setContent(mp);
Transport t = s.getTransport("smtp");
t.send(msg);
return 0;
} catch (Exception e) {
e.printStackTrace();
return 1;
}
I keep getting 550 5.7.1 Unable to relay for [email protected]
try {
Properties p = System.getProperties();
p.put("mail.smtp.host", "server IP");
p.put("mail.smtp.port", "25");
p.put("mail.debug", "true");
Session s = Session.getDefaultInstance(p);
Message msg = new MimeMessage(s);
msg.setFrom(new InternetAddress(from));
msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
msg.setSubject(subject);
Multipart mp = new MimeMultipart();
BodyPart bp = new MimeBodyPart();
bp.setText(message);
mp.addBodyPart(bp);
msg.setContent(mp);
Transport t = s.getTransport("smtp");
t.send(msg);
return 0;
} catch (Exception e) {
e.printStackTrace();
return 1;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须先登录您的 Exchange smtp。
或
更改您的交换设置以允许您无需登录即可发送
you must login into your exchange smtp first.
or
change your exchange setting to allow you sending without login
您的交换服务器可能不允许中继您提交给它的 IP?或者在中继之前可能需要身份验证。
Your exchange server probably doesn't allow relaying for the ip from which you are submitting to it? Or it might require authentication before relaying.