GithubHelp home page GithubHelp logo

tieusangaka / spring-boot-quartz-scheduler-email-scheduling Goto Github PK

View Code? Open in Web Editor NEW

This project forked from callicoder/spring-boot-quartz-scheduler-email-scheduling

0.0 1.0 0.0 55 KB

Spring Boot Quartz Scheduler Example that schedules Emails to be sent at a later time.

Home Page: https://www.callicoder.com/spring-boot-quartz-scheduler-email-scheduling-example/

Java 100.00%

spring-boot-quartz-scheduler-email-scheduling's Introduction

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 - 1.8.x

  2. Maven - 3.x.x

  3. MySQL - 5.x.x

Steps to Setup

1. Clone the application

git clone https://github.com/callicoder/spring-boot-mysql-rest-api-tutorial.git

2. Create MySQL database

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 -

spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username[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 -

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.

mysql> source <PATH_TO_QUARTZ_TABLES.sql>

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 -

mvn spring-boot:run

Scheduling an Email using the /scheduleEmail API

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, <br><br> <b>Think Big And Don’t Listen To People Who Tell You It Can’t Be Done. Life’s Too Short To Think Small.</b> <br><br> Cheers, <br>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!"}

spring-boot-quartz-scheduler-email-scheduling's People

Contributors

callicoder avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.