邮件连续多次发送失败

woxiangxin 2006-01-10 08:55:40
在发送邮件的时候时间间隔长一点没有问题,如果是连续多次发送就不行了
有如下异常:
Sending failed;
nested exception is:
class javax.mail.MessagingException: 554 Remote Return: 450 <DATA>: Data command rejected: Try again 2 minutes later

at javax.mail.Transport.send0(Transport.java:218)
at javax.mail.Transport.send(Transport.java:80)

程序是这样:
public boolean send(){
try {
Properties props = new Properties();
Session sendMailSession;
props.put("mail.smtp.auth","true");
props.put("mail.smtp.host", smtpServer); //smtp主机名
props.put("mail.smtp.user",address); //发送方邮件地址
props.put("mail.smtp.password",password); //邮件密码
PopupAuthenticator popA=new PopupAuthenticator();//邮件安全认证
popA.performCheck(username,password); //填写用户名及密码
sendMailSession = Session.getInstance(props, popA);
Message newMessage = new MimeMessage(sendMailSession);
newMessage.setFrom(new InternetAddress(address));
newMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(takeAddress)); //接收方邮件地址
newMessage.setSubject(title);
newMessage.setSentDate(new Date());
newMessage.setText(text); //邮件正文
Transport.send(newMessage);

return true;
}
catch (MessagingException ex)
{
ex.printStackTrace();
return false;
}
}
...全文
121 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
男人三十好累 2006-01-11
  • 打赏
  • 举报
回复
可能你要写一个多线程连续发

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧