Sandeep
Sandeep

Reputation: 2269

Regarding Spring mail API

In my project there is a requirement to create a job which will send multiple emails.. I was thinking to use Spring mail API. I checked there is a method

send(MimeMessage[] mimeMessages)

Which will send emails in batch, I have a question, if any of the mail failed while sending, will the whole job fails or rest of them will be sent? Is it possible to get a result that which one is successful and which one failed?

Upvotes: 0

Views: 200

Answers (1)

Jukka
Jukka

Reputation: 4663

Have a look at https://github.com/SpringSource/spring-framework/blob/master/spring-context-support/src/main/java/org/springframework/mail/javamail/JavaMailSenderImpl.java.

Messages are sent individually and the send(MimeMessage[]) method throws MailSendException which contains the messages that failed to go.

Upvotes: 3

Related Questions