Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/callicoder/spring-boot-quartz-scheduler-email-scheduling
Spring Boot Quartz Scheduler Example that schedules Emails to be sent at a later time.
https://github.com/callicoder/spring-boot-quartz-scheduler-email-scheduling
quartz quartz-scheduler schedule-jobs schedule-tasks scheduler spring spring-boot
Last synced: 3 days ago
JSON representation
Spring Boot Quartz Scheduler Example that schedules Emails to be sent at a later time.
- Host: GitHub
- URL: https://github.com/callicoder/spring-boot-quartz-scheduler-email-scheduling
- Owner: callicoder
- Created: 2018-09-03T09:13:19.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-06-14T10:05:40.000Z (7 months ago)
- Last Synced: 2024-12-30T13:37:23.235Z (10 days ago)
- Topics: quartz, quartz-scheduler, schedule-jobs, schedule-tasks, scheduler, spring, spring-boot
- Language: Java
- Homepage: https://www.callicoder.com/spring-boot-quartz-scheduler-email-scheduling-example/
- Size: 56.6 KB
- Stars: 160
- Watchers: 10
- Forks: 191
- Open Issues: 2
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Spring Boot Quartz Scheduler Example: Building an Email Scheduling app
**Complete Tutorial:** https://www.callicoder.com/spring-boot-quartz-scheduler-email-scheduling-example/
## Requirements
1. Java - 11
2. Maven - 3.x.x
3. MySQL - 5.x.x
## Steps to Setup
**1. Clone the application**
```bash
git clone https://github.com/callicoder/spring-boot-mysql-rest-api-tutorial.git
```**2. Create MySQL database**
```bash
create database quartz_demo
```**3. Change MySQL username and password as per your MySQL installation**
open `src/main/resources/application.properties`, and change `spring.datasource.username` and `spring.datasource.password` properties as per your mysql installation
**4. Setup Spring Mail**
The project is using Gmail's SMTP server for sending emails. Whether you use Gmail or any other SMTP server, you'll need to configure the following mail properties accordingly -
```properties
spring.mail.host=smtp.gmail.com
spring.mail.port=587
[email protected]
spring.mail.password=
```If you're using Gmail, you need to allow the third party apps to send emails by following the instructions below -
+ Go to https://myaccount.google.com/security?pli=1#connectedapps
+ Set ‘Allow less secure apps’ to YES**5. Create Quartz Tables**
The project stores all the scheduled Jobs in MySQL database. You'll need to create the tables that Quartz uses to store Jobs and other job-related data. Please create Quartz specific tables by executing the `quartz_tables.sql` script located inside `src/main/resources` directory.
```bash
mysql> source
```**6. Build and run the app using maven**
Finally, You can run the app by typing the following command from the root directory of the project -
```bash
mvn spring-boot:run
```## Scheduling an Email using the /scheduleEmail API
```bash
curl -i -H "Content-Type: application/json" -X POST \
-d '{"email":"[email protected]","subject":"Things I wanna say to my Future self","body":"Dear Future me,
Think Big And Don’t Listen To People Who Tell You It Can’t Be Done. Life’s Too Short To Think Small.
Cheers,
Rajeev!","dateTime":"2018-09-04T16:15:00","timeZone":"Asia/Kolkata"}' \
http://localhost:8080/scheduleEmail# Output
{"success":true,"jobId":"0741eafc-0627-446f-9eaf-26f5d6b29ec2","jobGroup":"email-jobs","message":"Email Scheduled Successfully!"}
```