A Java Spring Boot application to send emails with attachments to multiple, individually-selected recipients managed via a simple text file.
Sharing information within a community or group should be seamless, but managing recipient lists can be a hassle. Email Sender is a mini-project built to solve this. It's an efficient Java Spring Boot application that allows a user to send customized emails—with file attachments—to a list of recipients that is dynamically loaded from a simple text file.
This project demonstrates a full-stack, self-contained application using Spring Boot for the backend logic and Thymeleaf for rendering a simple, user-friendly HTML interface.
- ✅ Dynamic Recipient Management: Reads email addresses from a
.txtfile and displays them as a checklist. - ✅ Selective & Bulk Messaging: Gives the user fine-grained control to message individuals or the entire list with a "Select All" option.
- ✅ File Attachments: Effortlessly attach files (up to 10MB by default) to your emails.
- ✅ User-Friendly Interface: A simple HTML form for composing the subject and message body.
- ✅ Secure & Configurable: Email credentials are kept out of the code and managed in the
application.propertiesfile for security and ease of setup.
Main Interface - Recipient Selection & Composition
<-- Add a screenshot of your main UI here, showing the checkboxes, form fields, and file attachment button. -->
Email Sent - Success Message
<-- Add a screenshot of the success confirmation page here. -->
This project is not publicly deployed and is intended to be run on a local machine. Follow these instructions to get it set up.
- Java Development Kit (JDK) 11 or newer
- Apache Maven
- An IDE (like IntelliJ IDEA, Eclipse, or VS Code)
- An active email account (e.g., Gmail) to use as the sender.
-
Clone the repository:
git clone [https://github.com/_YOUR_USERNAME_/_YOUR_REPOSITORY_.git](https://github.com/_YOUR_USERNAME_/_YOUR_REPOSITORY_.git) cd _YOUR_REPOSITORY_ -
Configure Email & Attachment Properties: Open
src/main/resources/application.properties. This file holds all the necessary configurations. Update it with your sender email credentials and attachment settings.# Spring Mail Properties spring.mail.host=smtp.gmail.com spring.mail.port=587 spring.mail.username=your-email@gmail.com spring.mail.password=your-app-password # CRITICAL: Use an App Password, not your regular password! spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=true # File Upload Properties spring.servlet.multipart.enabled=true spring.servlet.multipart.max-file-size=10MB spring.servlet.multipart.max-request-size=10MB
🔒 Gmail Security Note: If you are using a Gmail account, you must enable 2-Factor Authentication and generate an "App Password". Using your regular Google account password will fail. Learn how to create App Passwords here.
-
Create the Recipient List: In the
src/main/resources/directory, create a file namedemails.txt. Add one email address per line. The application will read from this file.example.user1@domain.com test.user2@email.org another.recipient@provider.net
-
Build the project using Maven:
mvn clean install
-
Run the Spring Boot application:
mvn spring-boot:run
Alternatively, you can run the main application class
YourApplicationNameApplication.javadirectly from your IDE. -
Access the application: Open your web browser and navigate to
http://localhost:8080.
Here are the key files and directories in the project:
/src
├──/main
│ ├──/java/... # Main application Java source code (Controllers, Services)
│ └──/resources
│ ├──/templates # HTML files for the UI (e.g., index.html)
│ ├── emails.txt # Your list of recipient emails
│ └── application.properties # Application and email configuration
└──/test
pom.xml # Maven project configuration
This project is licensed under the MIT License. See the LICENSE file for more details.
Developed with ❤️ and Java by Bhargava A