utsav anand
utsav anand

Reputation: 385

Sending Bulk Email Async Without violating Limits Spring Boot

I have to send bulk email through java SMTP. Currently I send email synchronously which is taking a lot of time and since every email provider have their per hour limit, so I have to sleep thread to avoid limitation.

What will be the best approach to send email Asynchronously without violating limitation using SMTP.

Thanks in advance.

Upvotes: 2

Views: 1218

Answers (1)

Shibashis
Shibashis

Reputation: 8401

You should be able to send mails asynchronously running a new thread or using executor service.

But since you need capability to throttle outgoing mails you need a store and forward mechanism. Ideal solution would be using a queue where mesages can be posted. And then there should be a queue consumer which will be responsible for reading from the queue and sending the actual mail.

Upvotes: 1

Related Questions