This is a simple project demonstrating how to send emails using Java 17 LTS, Spring, Postman, and H2.
This project utilizes Spring Boot to create a service that allows sending emails via a RESTful API. H2 is used as an in-memory database to store email sending records.
- JDK 17 LTS installed
- Maven 3.x installed
- Postman (for testing the API)
-
Clone the repository:
git clone https://github.com/josivantarcio/sendMail-Java.git -
Navigate to the project directory:
cd sendMail-Java -
Run the project using Maven:
mvn spring-boot:run
-
Use Postman or any other tool to send HTTP requests to the API endpoint:
POST http://localhost:8080/api/send-emailExample request body:
{ "to": "recipient@example.com", "subject": "Email Subject", "body": "Email Content" } -
Check the Spring Boot console for email sending logs and H2 database confirmations.
Contributions are welcome! Feel free to open a pull request or report issues.
This project is licensed under the MIT License.