Class MailSendException
- All Implemented Interfaces:
Serializable
- Author:
- Dmitriy Kopylenko, Juergen Hoeller
- See Also:
-
Constructor Summary
ConstructorDescriptionMailSendException
(String msg) Constructor for MailSendException.MailSendException
(String msg, Throwable cause) Constructor for MailSendException.Constructor for registration of failed messages, with the messages that failed as keys, and the thrown exceptions as values.MailSendException
(Map<Object, Exception> failedMessages) Constructor for registration of failed messages, with the messages that failed as keys, and the thrown exceptions as values. -
Method Summary
Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getMostSpecificCause, getRootCause
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace
-
Constructor Details
-
MailSendException
Constructor for MailSendException.- Parameters:
msg
- the detail message
-
MailSendException
Constructor for MailSendException.- Parameters:
msg
- the detail messagecause
- the root cause from the mail API in use
-
MailSendException
public MailSendException(@Nullable String msg, @Nullable Throwable cause, Map<Object, Exception> 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.
- Parameters:
msg
- the detail messagecause
- the root cause from the mail API in usefailedMessages
- a Map of failed messages as keys and thrown exceptions as values
-
MailSendException
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.
- Parameters:
failedMessages
- a Map of failed messages as keys and thrown exceptions as values
-
-
Method Details
-
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, that is, SimpleMailMessages in case of using the generic MailSender interface.
In case of sending MimeMessage instances via JavaMailSender, the messages will be of type MimeMessage.
NOTE: This Map will not be available after serialization. Use
getMessageExceptions()
in such a scenario, which will be available after serialization as well.- Returns:
- the Map of failed messages as keys and thrown exceptions as values
- See Also:
-
getMessageExceptions
Return an array with thrown message exceptions.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.
- Returns:
- the array of thrown message exceptions, or an empty array if no failed messages
-
getMessage
- Overrides:
getMessage
in classThrowable
-
toString
-
printStackTrace
- Overrides:
printStackTrace
in classThrowable
-
printStackTrace
- Overrides:
printStackTrace
in classThrowable
-