public class MailSendException extends MailException
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.Object,java.lang.Exception> |
failedMessages |
private java.lang.Exception[] |
messageExceptions |
Constructor and Description |
---|
MailSendException(java.util.Map<java.lang.Object,java.lang.Exception> failedMessages)
Constructor for registration of failed messages, with the
messages that failed as keys, and the thrown exceptions as values.
|
MailSendException(java.lang.String msg)
Constructor for MailSendException.
|
MailSendException(java.lang.String msg,
java.lang.Throwable cause)
Constructor for MailSendException.
|
MailSendException(java.lang.String msg,
java.lang.Throwable cause,
java.util.Map<java.lang.Object,java.lang.Exception> failedMessages)
Constructor for registration of failed messages, with the
messages that failed as keys, and the thrown exceptions as values.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.Object,java.lang.Exception> |
getFailedMessages()
Return a Map with the failed messages as keys, and the thrown exceptions
as values.
|
java.lang.String |
getMessage()
Return the detail message, including the message from the nested exception
if there is one.
|
java.lang.Exception[] |
getMessageExceptions()
Return an array with thrown message exceptions.
|
void |
printStackTrace(java.io.PrintStream ps) |
void |
printStackTrace(java.io.PrintWriter pw) |
java.lang.String |
toString() |
contains, getMostSpecificCause, getRootCause
private final transient java.util.Map<java.lang.Object,java.lang.Exception> failedMessages
@Nullable private final java.lang.Exception[] messageExceptions
public MailSendException(java.lang.String msg)
msg
- the detail messagepublic MailSendException(java.lang.String msg, @Nullable java.lang.Throwable cause)
msg
- the detail messagecause
- the root cause from the mail API in usepublic MailSendException(@Nullable java.lang.String msg, @Nullable java.lang.Throwable cause, java.util.Map<java.lang.Object,java.lang.Exception> failedMessages)
The messages should be the same that were originally passed to the invoked send method.
msg
- the detail messagecause
- the root cause from the mail API in usefailedMessages
- a Map of failed messages as keys and thrown
exceptions as valuespublic MailSendException(java.util.Map<java.lang.Object,java.lang.Exception> failedMessages)
The messages should be the same that were originally passed to the invoked send method.
failedMessages
- a Map of failed messages as keys and thrown
exceptions as valuespublic final java.util.Map<java.lang.Object,java.lang.Exception> getFailedMessages()
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.
SimpleMailMessage
,
javax.mail.internet.MimeMessage
public final java.lang.Exception[] getMessageExceptions()
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.
@Nullable public java.lang.String getMessage()
NestedRuntimeException
getMessage
in class NestedRuntimeException
public java.lang.String toString()
toString
in class java.lang.Throwable
public void printStackTrace(java.io.PrintStream ps)
printStackTrace
in class java.lang.Throwable
public void printStackTrace(java.io.PrintWriter pw)
printStackTrace
in class java.lang.Throwable