Skip to content

Korges/java-rest-mail-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

java-rest-mail-api

you can use swager interface. Link below:

http://localhost:8080/swagger-ui.html#/email-controller

1. Set up your email credentials under application.properties

you can check example there
https://www.baeldung.com/spring-email#2-spring-boot-mail-server-properties

2. Create email

POST http://localhost:8080/emails
sample json input:

{
    "subject": "Welcome",
    "text": "How are you?",
    "recipients": [
    	"[email protected]"
    ]
}

response:

{
    "id": "5f0202f2c2f3ab3234d3bac6",
    "subject": "Welcome",
    "text": "How are you?",
    "recipients": [
        "[email protected]"
    ],
    "attachments": [],
    "emailStatus": "PENDING",
    "priority": "LOWEST"
}

3. Send email

POST http://localhost:8080/emails/send/5f0202f2c2f3ab3234d3bac6
response:

{
    "id": "5f0202f2c2f3ab3234d3bac6",
    "subject": "Welcome",
    "text": "How are you?",
    "recipients": [
        "[email protected]"
    ],
    "attachments": [],
    "emailStatus": "SENT",
    "priority": "LOWEST"
}

4. You can add attachments. Enter attachment filepath. You can put them under /resources package

{
    "subject": "Welcome",
    "text": "How are you?",
    "recipients": [
    	"[email protected]"
    ],
    "attachments": ["attachment.txt"]
}

5. You can set priority. By default its LOWEST

  • HIGHEST
  • HIGH
  • MIDDLE
  • LOW
  • LOWEST

example:
POST http://localhost:8080/emails

{
    "subject": "Welcome",
    "text": "How are you?",
    "recipients": [
    	"[email protected]"
    ],
    "priority": "HIGHEST"
}

6. All API methods:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages