Skip to content

JavaMailSenderImpl should report failedMessages in the event of a network error [SPR-7245] #11904

@spring-projects-issues

Description

@spring-projects-issues

Edd Grant opened SPR-7245 and commented

When sending email in JavaMailSenderImpl, in the event that there are any failed messages the doSend() method includes a Map<MimeMessage, Exception> in the raised MailSendException. This is particularly useful as it allows the caller to identify exactly which emails have failed taking the appropriate action only for those emails.

However if a network problem occurs part way through a send (let's say the socket is closed abnormally) then the MailSendException that is thrown only contains the exception (in this case a SocketException) which has caused the failure.

It would be very useful if the messages which were not sent could be added to the failedMessages Map of the thrown MailSendException along with the causing exception. This would allow the caller to take the appropriate action (which in the case of a network failure might be a delayed retry) for only those messages which were underlivered.

Cheers,

Edd


Affects: 2.5.6

Referenced from: commits 433b4ef

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions