Releases: ozimov/spring-boot-email-tools
Minor fixes in MimeMessage hadling
Fixed issue with MimeMessage not saved after changes.
Fixed encoding of attachment file names.
Fixed search for subpath in Thymeleaf
Thymeleaf template engine was not receiving templates with subpath from the resources/template
folder.
Breaking change for SchedulerService
The release presents a change that breaks the backward compatibility and another that ensures more flexibility in handling the templates. Specifically:
SchedulerService
interface is now renamed into EmailSchedulerService
to ensure more semantic.
Each implemented template engine ensure that the template name can be provided without extension, therefore the default or the provided extension is applied.
Minor fixes for MimeMessage generation and logging
This release includes a couple of minor changes.
MimeMessage
switched the value for the user-definedReturn-Receipt-To
andDisposition-Notification-To
.- Email logging now supports the hide email-field functionality.
Email logging
This minor release introduces two changes.
Additions into the SchedulerService
interface
The interface has now two methods, identical to the previous ones, but with no OffsetDateTime
to be provided. By default, the current date and time at UTC is provided to the scheduler service.
Logging customized for emails
Most likely, you will need to log the email you just sent or scheduled, but you would also like to avoid a full
toString
of the given email object. For instance, you may want to anonymize an email address, or to ignore custom headers, or to format the sending date and time. Now, you can do it by just providing some custom properties.
Here follows a list of properties you can use with some examples:
spring.mail.logging.enabled=true
spring.mail.logging.strategy.from=PLAIN_TEXT
spring.mail.logging.strategy.replyTo=HIDDEN
spring.mail.logging.strategy.to=FULL_TEXT_FROM_COMMERCIAL_AT,
spring.mail.logging.strategy.cc=HIDDEN
spring.mail.logging.strategy.bcc=HIDDEN
spring.mail.logging.strategy.subject=PLAIN_TEXT
spring.mail.logging.strategy.body=FIRST_DOZEN_THEN_STARS
spring.mail.logging.strategy.attachments=HIDDEN
spring.mail.logging.strategy.encoding=HIDDEN
spring.mail.logging.strategy.locale=HIDDEN
spring.mail.logging.strategy.sentAt=STANDARD_DATE_FORMAT_WITH_ZONE_ID
spring.mail.logging.strategy.receiptTo=HIDDEN
spring.mail.logging.strategy.depositionNotificationTo=HIDDEN
spring.mail.logging.strategy.ignore.customHeaders=true
spring.mail.logging.strategy.ignore.nullAndEmptyCollections=true
Allowed logging strategies are defined in the enum it.ozimov.springboot.mail.logging.LoggingStrategy
.
Do not pretend to apply a date-only strategy to an email address, or an email address-only strategy to
a text field. Usage should be straightforward.
Email can have custom headers
This minor release ships a minor feature that enable to set custom headers in the email.
the new method to be used for the Email
interface is setCustomHeaders
.
For the default implementation, you can also use the builder.
Map<String, String> headers = ...
final Email email = DefaultEmail.builder()
.from(new InternetAddress("cicero@mala-tempora.currunt", "Marco Tullio Cicerone "))
.to(Lists.newArrayList(new InternetAddress("titus@de-rerum.natura", "Pomponius Attĭcus")))
.subject("Laelius de amicitia")
.body("Firmamentum autem stabilitatis constantiaeque eius, quam in amicitia quaerimus, fides est.")
.customHeaders(headers)
.encoding(Charset.forName("UTF-8")).build();
New scheduling-persistence interaction
Release 0.5.0 introduces three major changes.
First, to enable the library in a Spring Boot application, it is now sufficient to use the annotation @EnableEmailTools
which makes the use of @ComponentScan
obsolete.
Second, the default scheduler relies now on two threads. The former was already there in the previous release and consumes emails in the priority queues; The latter tries to load emails from the persistence layer at a fixed cycle length (5 seconds).
Finally, all the classes in core have been moved from package
it.ozimov.springboot.mail.templating
to package
it.ozimov.springboot.mail
Fixed concurrency issue and made REDIS configurable
This minor release includes fixed and minor features.
- It fixes a concurrency issue within the scheduler.
- Uses a new version of EmbeddedResids that shuts down the Thread pool executor on application close.
- it adds the support for providing REDIS settings via the new application property
spring.mail.scheduler.persistence.redis.settings
. The provided properties must be comma separated. For instance:spring.mail.scheduler.persistence.redis.settings=appendfilename email_appendonly.aof, dir /Users/your_username/REDIS/AppendOnlyFiles
Made EmailScheduler disabled by default
The email scheduler has been made disabled by default. It has to be enabled as:
spring.mail.scheduler.enabled=true
and the number of priority levels is specified as follows:
spring.mail.scheduler.priorityLevels=5
Moreover, some properties are now redefined for the persistence layer. The set of available properties is:
spring.mail.scheduler.persistence.enabled=true
spring.mail.scheduler.persistence.redis.enabled=true
spring.mail.scheduler.persistence.redis.embedded=true
spring.mail.scheduler.persistence.redis.host=localhost
spring.mail.scheduler.persistence.redis.port=6381
spring.mail.scheduler.persistence.desiredBatchSize=200
spring.mail.scheduler.persistence.minKeptInMemory=100
spring.mail.scheduler.persistence.maxKeptInMemory=1000
where the last three were
spring.mail.scheduler.persistenceLayer.desiredBatchSize=200
spring.mail.scheduler.persistenceLayer.minKeptInMemory=100
spring.mail.scheduler.persistenceLayer.maxKeptInMemory=1000
[FEATURE RELEASE] REDIS-based Persistence Layer
This minor release introduces an optional persistence layer to the scheduler. Whenever an email get scheduled, if the following property is set to true
spring.mail.persistence.enabled: true
then the PriorityQueueSchedulerService
looks for a bean implementing the PersistenceService
interface.
By the default, an implementation based on embedded REDIS is provided. It must be enabled by adding the following properties
spring.mail.persistence.redis.embedded: true
spring.mail.persistence.redis.enabled: true
spring.mail.persistence.redis.host: localhost
spring.mail.persistence.redis.port: 6381