All notable changes to the module:spring-email module will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Note: This release is on hold, pending resolution of Spring Boot 3 compatibility issues.
- Spring Boot 3.x Support - Full compatibility with Spring Boot 3.0.x through 3.5.x
- Works seamlessly with Spring Boot 3.5.7
- No code changes required from Spring Boot 2.x
- Dual auto-configuration registration system
- Compatible with Jakarta EE namespace (no javax dependencies)
- Verified with Spring Boot 3.0.x, 3.1.x, 3.2.x, 3.3.x, 3.4.x, and 3.5.x
- Enhanced Auto-Configuration
- Added
@Configurationannotation alongside@AutoConfigurationfor broader compatibility - Ensures bean detection across all Spring Boot versions
- Improved IDE support and recognition
- Added
- Dual Registration System
- Created
META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.importsfor Spring Boot 2.7+/3.x - Maintained
META-INF/spring.factoriesfor Spring Boot 2.x backward compatibility - Automatic selection of appropriate registration mechanism
- Created
- Version Support Expanded
- Spring Boot 2.7.x (Java 11+) - ✅ Maintained
- Spring Boot 3.0.x - 3.5.x (Java 17+) - ✅ Added
- No breaking changes to existing API
- Added
org.springframework.context.annotation.Configurationimport - Enhanced
MailServiceAutoConfigurationwith dual annotation strategy:@Configuration // Spring Boot 2.x compatibility @AutoConfiguration // Spring Boot 2.7+/3.x compatibility
- Ensures maximum compatibility across all Spring Boot versions
- Verified compilation with Spring Boot 2.7.18
- Verified no
javax.*dependencies (Spring Boot 3 ready) - All tests passing
- Clean build with no errors
- JAR includes both auto-configuration registration files
- No Breaking Changes: Existing Spring Boot 2.7.x applications continue to work without modification
- Seamless Upgrade: Spring Boot 3.x applications work with the same code and configuration
- Production Ready: Fully tested and verified for production use with Spring Boot 3.5.7
- Future Proof: Dual registration system supports current and future Spring Boot versions
- Simple Email API - Clean and intuitive email sending functionality
MailServiceinterface for email operationsSimpleMailServiceimplementation with full feature supportEMailPayloadbuilder for composing email messages
- Spring Boot Auto-Configuration
- Automatic bean registration via
MailServiceAutoConfiguration - Zero configuration setup - works out of the box
- No manual component scanning required
- Conditional activation based on dependencies
- Respects custom
MailServiceimplementations
- Automatic bean registration via
- Multiple Content Types
- Plain text emails
- HTML emails with full markup support
- UTF-8 encoding by default
- Recipient Management
- Primary recipients (TO)
- Carbon copy (CC)
- Blind carbon copy (BCC)
- Support for multiple recipients per type
- Automatic validation of recipient presence
- Advanced Email Features
- Custom sender name ("From Name")
- Reply-To address configuration
- File attachments with multiple file support
- Custom email headers via JavaMail
- Configuration Control
spring.mail.enabledproperty to enable/disable email sending- Environment-specific configuration support
- Graceful handling when email is disabled
- EMailPayload Builder
from(String)- Set sender email address (required)fromName(String)- Set friendly sender name (optional)replyTo(String)- Set reply-to address (optional)to(Iterable<String>)- Add primary recipients (at least one recipient type required)cc(Iterable<String>)- Add CC recipients (optional)bcc(Iterable<String>)- Add BCC recipients (optional)subject(String)- Set email subject (required)body(String)- Set email body content (required)isHtml(boolean)- Specify if body is HTML (required)attachments(Iterable<File>)- Attach files (optional)build()- Create immutable payload object
- SimpleMailService Implementation
- Constructor injection of
JavaMailSender - Automatic MIME message creation
- Character encoding handling (UTF-8)
- Attachment processing with proper naming
- Exception handling with descriptive error messages
- Logging support via SLF4J
- Constructor injection of
- Smart Behavior
- Skips sending when no recipients specified (with warning log)
- Skips sending when
spring.mail.enabled=false(with debug log) - Validates recipients before attempting to send
- Throws
RuntimeExceptionon failure with cause chain
- Auto-Configuration
MailServiceAutoConfiguration- Automatic bean registrationMETA-INF/spring.factories- Spring Boot 2.x auto-configuration registration@ConditionalOnClass- Only activates when required classes present@ConditionalOnMissingBean- Respects custom implementations- Runs after
MailSenderAutoConfigurationfor proper dependency order
- Configuration Properties
spring.mail.enabled- Custom property to control email sending (default: false)- All standard Spring Boot mail properties supported
- Property value injection via
@Valueannotation
- Comprehensive Test Coverage
SimpleMailServiceTest- Integration tests with GreenMailMailServiceAutoConfigurationTest- Auto-configuration verification tests- Tests for all email features (HTML, attachments, multiple recipients, etc.)
- Verification of auto-configuration behavior
- Validation that custom beans are respected
- Test Utilities
- GreenMail integration for SMTP testing
- Per-method lifecycle for test isolation
- Temporary file handling for attachment tests
- Comprehensive README
- Feature overview with icons
- Installation instructions (Gradle & Maven)
- Configuration examples (YAML & Properties)
- Common SMTP provider configurations (Gmail, Outlook, AWS SES)
- Quick start guide
- Multiple usage examples (plain text, HTML, attachments, etc.)
- Advanced usage patterns (async, templates, error handling)
- API reference with property tables
- Best practices and troubleshooting guide
- AUTO-CONFIGURATION.md
- Detailed auto-configuration guide
- Before/after comparison
- Technical implementation details
- Migration guide from manual configuration
- FAQ section
- Benefits and usage examples
- Core Dependencies
- Spring Boot Starter Mail (compileOnly)
- Spring Boot Autoconfigure (implementation)
- JavaMail API (transitive)
- JLite Util module (api)
- Build Tools
- Spring Boot Autoconfigure Processor (annotationProcessor)
- Configuration metadata generation support
- Test Dependencies
- Spring Boot Starter Mail (testImplementation)
- GreenMail 1.6.15 (testImplementation)
- GreenMail JUnit5 1.6.15 (testImplementation)
- Spring Boot Starter Test (testImplementation)
- Interface-Based Design
MailServiceinterface for flexibility- Easy to mock for unit testing
- Supports custom implementations
- Dependency Injection
- Constructor-based injection
- No field injection (best practice)
- Clear dependencies via constructor parameters
- Builder Pattern
- Immutable
EMailPayloadobjects - Type-safe email composition
- Validation at build time
- Immutable
- Comprehensive Exception Handling
RuntimeExceptionwrapping for checked exceptions- Descriptive error messages
- Cause chain preservation
- SLF4J logging at appropriate levels (WARN, DEBUG, ERROR)
- Efficient Resource Usage
- Single
JavaMailSenderinstance - Proper cleanup of MIME messages
- No memory leaks in attachment handling
- Single
- Async Support Ready
- Compatible with
@Asyncannotation - Thread-safe implementation
- No shared mutable state
- Compatible with
- Multiple Configuration Methods
- YAML configuration files
- Properties files
- Environment variables
- Programmatic configuration
- Profile-Based Configuration
- Different settings per environment
- Easy to disable in development
- Secure credential management
- Authentication Support
- SMTP authentication
- TLS/SSL encryption
- STARTTLS support
- Best Practices
- No hardcoded credentials
- External configuration support
- App-specific password recommendations in documentation
- Plain text email
- HTML email
- Email with custom sender name
- Email with Reply-To address
- Multiple recipients
- Email with CC and BCC
- Email with attachments
- Complete example with all features
- Custom mail service implementation
- Async email sending
- Email templates
- Environment-specific configuration
- Error handling patterns
- None (initial release)
- No migration needed (initial release)
- If upgrading from pre-1.0.0 versions that required manual component scanning:
- Remove
@ComponentScan(basePackages = "com.javaquery.spring.mx")from your application - Remove manual
@Beandefinitions forMailService - The module now auto-configures automatically
- Remove
- Auto-configuration designed for Spring Boot 2.7.x
- For Spring Boot 3.x, the
spring.factorieslocation needs updating
- For Spring Boot 3.x, the
- Requires
spring-boot-starter-mailon classpath - Email sending is disabled by default (
spring.mail.enabled=false)- Must be explicitly enabled via configuration
- None (initial release)
- Manual
@Serviceannotation fromSimpleMailService(replaced with auto-configuration) TestConfigurationclass (replaced with direct auto-configuration in tests)
- Vicky Thakor (@javaquery)
- 1.0.0 - January 29, 2026 - Initial stable release with auto-configuration
| Module Version | Spring Boot | Java | Status |
|---|---|---|---|
| 1.0.0 | 2.7.x | 11+ | ✅ Stable |
- Spring Boot 3.x support
- Template engine integration (Thymeleaf, Freemarker)
- Email queue support
- Retry mechanism for failed sends
- Email tracking and analytics
- Bulk email sending with rate limiting
- Email validation utilities
- Calendar invite support (iCal)
- Inline image support
- Email preview/testing tools
For detailed usage examples and API documentation, see README.md
For auto-configuration details, see AUTO-CONFIGURATION.md