如何以编程方式捕获退回的电子邮件

时间:2016-07-22 08:37:37

标签: java javamail bouncedemail

使用JavaMail,我正在创建一个可以处理退回电子邮件的程序。我指的是这个教程http://www.tutorialspoint.com/javamail_api/javamail_api_bounced_messages.htm

如果电子邮件被退回,有没有办法捕获?

boolean bounce = false; //how can i make this TRUE if the email is bounced?
try {
   System.out.println("Sending ....");
   transport.connect(smtpServer, port, userid, password);
   transport.sendMessage(message,
   message.getRecipients(Message.RecipientType.TO));
   System.out.println("Sending done ...");
} catch (Exception e) {
   System.err.println("Error Sending: ");
   e.printStackTrace();
}

提前致谢!

0 个答案:

没有答案