Skip to content
Advertisement

Sending an email at a specific time using spring boot [closed]

in the application I am developing I can specify an expiration date of a license and now I want to create an a java spring boot api that can send an email to a specific email before a specific time period (the user can choose the time period). The purpose of the email is to notify the user that his license is about to end.

For example: The user chooses an expiration date of 3/8/2023 and chooses to be notified 3 months before the expiration date chosen. An email gets sent to the user’s email on 3/5/2023 notifying the user that the license is about to end.

Any help is highly appreciated.

Advertisement

Answer

  1. You need to store the info in database. So that your system knows when to send the email. For ex, having two columns in a table like send_notif_date, send_to_user.
  2. write a job(you can use Quartz for this) which will pick all details of user for which we need to send the emails based on if today equalsTo send_notif_date
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement