This is a Spring Boot-based Email Sender Application that allows users to send emails through a simple and user-friendly interface. The backend is built with Spring Boot, and the frontend is developed using HTML, CSS, and JavaScript. This project supports Java 17 and integrates with SMTP for sending emails.
- Send emails to any recipient.
- Simple frontend with a lightweight design.
- Secure SMTP authentication.
- Configurable SMTP settings via
application.properties
. - Built for Java 17.
EmailSender/ ├── src/ │ ├── main/ │ │ ├── java/com/emailsender/ │ │ │ ├── EmailSenderApplication.java # Main application file │ │ │ ├── controller/EmailController.java # REST API controller │ │ │ ├── service/EmailService.java # Email sending logic │ │ ├── resources/ │ │ │ ├── application.properties # Email configuration │ │ ├── webapp/ │ │ │ ├── index.html # Frontend HTML │ │ │ ├── styles.css # Frontend CSS ├── pom.xml # Maven dependencies
- Java 17 or later installed.
- Maven installed.
- An email account for SMTP (e.g., Gmail, Outlook).
git clone https://github.com/your-username/email-sender.git cd email-sender
- Open the
src/main/resources/application.properties
file. - Update the following properties with your email and password:
spring.mail.host=smtp.gmail.com spring.mail.port=587 spring.mail.username=your-email@gmail.com spring.mail.password=your-app-password spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=true
-
For Gmail:
- If you use 2FA, create an App Password.
- If not, enable "Less Secure Apps" in your Google Account settings.
mvn clean install mvn spring-boot:run
Open your browser and go to:
http://localhost:8080
Fill in the form with the recipient email, subject, and message, then click Send Email.
POST /api/email/send
Parameter | Type | Description |
---|---|---|
to |
String | Recipient email address |
subject |
String | Email subject |
body |
String | Email message body |
curl -X POST "http://localhost:8080/api/email/send" \ -d "to=example@example.com&subject=Hello&body=Test message"
Success:
"Email sent successfully to example@example.com"
Error:
"Error sending email: Authentication failed"
This project is licensed under the MIT License. See the LICENSE
file for details.