* return boolean true: handling was successful, exception can be ignored;
* false: handling was not successful, refuse to proceed.
*/
private boolean handleSendFailedException(SendFailedException e) {
//get wrapped excpetion
MessagingException me = (MessagingException) e.getNextException();
if (me instanceof AuthenticationFailedException) {
// catch this one separately, this kind of exception has no message
// as the other below
StringBuilder infoMessage = new StringBuilder();
infoMessage.append(translate("error.msg.send.nok"));
infoMessage.append("<br />");
infoMessage.append(translate("error.msg.smtp.authentication.failed"));
this.getWindowControl().setInfo(infoMessage.toString());
log.warn("Mail message could not be sent: ", e);
// message could not be sent, however let user proceed with his action
return true;
}
String message = me.getMessage();
if (message.startsWith("553")) {
//javax.mail.MessagingException: 553 5.5.4 <invalid>... Domain name
// required for sender address invalid@id.unizh.ch
//javax.mail.MessagingException: 553 5.1.8 <invalid@invalid.>...
// Domain of sender address invalid@invalid does not exist