类 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
- 所有已实现的接口:
Serializable
public class MailSendException extends MailException
Exception thrown when a mail sending error is encountered. Can register failed messages with their exceptions.- 作者:
- Dmitriy Kopylenko, Juergen Hoeller
- 另请参阅:
- 序列化表格
构造器概要
构造器 构造器 说明 MailSendException(String msg)
Constructor for MailSendException.MailSendException(String msg, Throwable cause)
Constructor for MailSendException.MailSendException(String msg, 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.MailSendException(Map<Object,Exception> failedMessages)
Constructor for registration of failed messages, with the messages that failed as keys, and the thrown exceptions as values.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 Map<Object,Exception>
getFailedMessages()
Return a Map with the failed messages as keys, and the thrown exceptions as values.String
getMessage()
Return the detail message, including the message from the nested exception if there is one.Exception[]
getMessageExceptions()
Return an array with thrown message exceptions.void
printStackTrace(PrintStream ps)
void
printStackTrace(PrintWriter pw)
String
toString()
从类继承的方法 org.springframework.core.NestedRuntimeException
contains, getMostSpecificCause, getRootCause
从类继承的方法 java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, setStackTrace
构造器详细资料
MailSendException
public MailSendException(String msg)
Constructor for MailSendException.- 参数:
msg
- the detail message
MailSendException
public MailSendException(String msg, Throwable cause)
Constructor for MailSendException.- 参数:
msg
- the detail messagecause
- the root cause from the mail API in use
MailSendException
public MailSendException(String msg, 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.
- 参数:
msg
- the detail messagecause
- the root cause from the mail API in usefailedMessages
- Map of failed messages as keys and thrown exceptions as values
MailSendException
public MailSendException(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.
- 参数:
failedMessages
- Map of failed messages as keys and thrown exceptions as values
方法详细资料
getFailedMessages
public final Map<Object,Exception> 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.- 返回:
- the Map of failed messages as keys and thrown exceptions as values
- 另请参阅:
SimpleMailMessage
,MimeMessage
getMessageExceptions
public final Exception[] 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.
- 返回:
- the array of thrown message exceptions, or an empty array if no failed messages
getMessage
public String getMessage()
从类复制的说明:NestedRuntimeException
Return the detail message, including the message from the nested exception if there is one.- 覆盖:
getMessage
在类中NestedRuntimeException
printStackTrace
public void printStackTrace(PrintStream ps)
- 覆盖:
printStackTrace
在类中Throwable
printStackTrace
public void printStackTrace(PrintWriter pw)
- 覆盖:
printStackTrace
在类中Throwable