Skip to content

AjayRay230/JavaMailSender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Perfect! Here’s a fancier, portfolio-ready README with badges, a β€œTry API” section, and clean formatting that will look professional on GitHub:

# Portfolio Backend

[![Java](https://img.shields.io/badge/Java-17+-blue)](https://www.oracle.com/java/) 
[![Spring Boot](https://img.shields.io/badge/Spring%20Boot-3.2-green)](https://spring.io/projects/spring-boot) 
[![License](https://img.shields.io/badge/License-MIT-yellow)](LICENSE)

A Spring Boot backend service for handling contact messages from a portfolio website.  
It receives messages from a contact form and sends them via email.



## πŸ”Ή Features

- REST API to receive contact messages  
- Sends email notifications to the portfolio owner  
- Uses Spring Boot, JavaMailSender, and Lombok  
- CORS enabled for all origins  

---

## πŸ“¦ Technologies

- Java 17+  
- Spring Boot 3.x  
- Spring Web  
- Spring Mail  
- Lombok  

---

## πŸš€ API Endpoint

### POST `/api/contact/message`

Send a contact message to the portfolio owner.

**Request Body:**

```json
{
  "name": "John Doe",
  "email": "john@example.com",
  "message": "Hello! I am interested in your portfolio."
}

Response:

"Message sent successfully!"

βš™οΈ Configuration

Add your email credentials in application.properties:

spring.mail.host=smtp.example.com
spring.mail.port=587
spring.mail.username=your-email@example.com
spring.mail.password=your-email-password
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true

Emails will be sent from and to this address. Make sure your email provider allows SMTP access (Gmail requires an App Password).


πŸ’» Usage

  1. Clone the repository:
git clone https://github.com/yourusername/PortfolioBackend.git
cd PortfolioBackend
  1. Build the project:
./mvnw clean install
  1. Run the application:
./mvnw spring-boot:run
  1. Test the API using Postman, curl, or your frontend:
curl -X POST http://localhost:8080/api/contact/message \
-H "Content-Type: application/json" \
-d '{"name":"John Doe","email":"john@example.com","message":"Hello!"}'

🌐 Try API

You can also test the API live from your frontend portfolio or using tools like:


πŸ“ Notes

  • Modify @CrossOrigin in ContactController to restrict access if needed.
  • Ensure your SMTP credentials are correct.

About

send mail using Java (JavaMailSender)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages