org.springframework.mail
Class MailSendException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--java.lang.RuntimeException
                    |
                    +--org.springframework.core.NestedRuntimeException
                          |
                          +--org.springframework.mail.MailException
                                |
                                +--org.springframework.mail.MailSendException

public class MailSendException
extends MailException

Exception thrown when a mail sending error is encountered. Can register failed messages with their exceptions.

Author:
Dmitriy Kopylenko, Juergen Hoeller
Version: $Id: MailSendException.java,v 1.5 2003/11/13 11:51:26 jhoeller Exp $

Constructor Summary
MailSendException(String msg)
           
MailSendException(String msg, Throwable ex)
           
MailSendException(Map failedMessages)
          Constructor for registration of failed messages, with the messages that failed as keys, and the thrown exceptions as values.

Method Summary
 MapgetFailedMessages()
          Return a Map with the failed messages as keys, and the thrown exceptions as values.
 StringgetMessage()
           
 voidprintStackTrace(PrintStream ps)
           
 voidprintStackTrace(PrintWriter pw)
           

Methods inherited from class org.springframework.core.NestedRuntimeException
getCause

Methods inherited from class java.lang.Throwable
printStackTrace, getStackTrace, setStackTrace, getLocalizedMessage, toString, fillInStackTrace, initCause

Methods inherited from class java.lang.Object
hashCode, notify, notifyAll, wait, wait, wait, getClass, equals

Constructor Detail

MailSendException

public MailSendException(String msg)

MailSendException

public MailSendException(String msg, Throwable ex)

MailSendException

public MailSendException(Map failedMessages)
Constructor for registration of failed messages, with the messages that failed as keys, and the thrown exceptions as values.

The messages should be the same that were originally passed to the invoked send method.

Method Detail

getFailedMessages

public Map getFailedMessages()
Return a Map with the failed messages as keys, and the thrown exceptions as values. Note that a general mail server connection failure will not result in failed messages being returned here: A message will only be contained here if actually sending it was attempted but failed.

The messages will be the same that were originally passed to the invoked send method, i.e. SimpleMailMessages in case of using the generic MailSender interface.

In case of sending MimeMessage instances via JavaMailSender, the messages will be of type MimeMessage.

Returns: the Map of failed messages as keys and thrown exceptions as values, or an empty Map if no failed messages

getMessage

public String getMessage()

printStackTrace

public void printStackTrace(PrintStream ps)

printStackTrace

public void printStackTrace(PrintWriter pw)

Association Links

to Class java.util.Map