Skip to content

Releases: ozimov/spring-boot-email-tools

[BugFix] Email without attachment are not set

03 Feb 15:57
Compare
Choose a tag to compare

The release fixes a bug due to emails without any non-null value for the attachments. Not setting explicitly the emails with an empty Collection of EmailAttachment was causing a NPE. The issue was introduced with release 0.3.7.

[BugFix] Attachments content type not properly guessed

09 Jan 16:45
Compare
Choose a tag to compare

This release fixed the email attachment by removing the content type guess for the attachments.

[BugFix] Attachments could not be handled

07 Jan 20:51
Compare
Choose a tag to compare

This minor release fixes a bug related to attachments. Whenever an attachment was provided, the mime type of the email was not properly set.
Additional unit tests have been added.

[Improvement] Receipt notification added

07 Jan 20:54
Compare
Choose a tag to compare

Added support for email receipt notification

[FEATURE RELEASE] Added support for generic template engines

07 Jan 21:14
Compare
Choose a tag to compare

#Template engines support
The project is now organized in modules. The sender service along with the scheduler are in the following dependency in Maven

<dependency>
    <groupId>it.ozimov</groupId>
    <artifactId>spring-boot-email-core</artifactId>
    <version>0.3.0</version>
</dependency>

To support template engines, specific modules must be added.
To embed the module that includes the Freemarker template engine, you can use the following Maven dependency:

<dependency>
    <groupId>it.ozimov</groupId>
    <artifactId>spring-boot-freemarker-email</artifactId>
    <version>0.3.6</version>
</dependency>

for Mustache:

<dependency>
    <groupId>it.ozimov</groupId>
    <artifactId>spring-boot-mustache-email</artifactId>
    <version>0.3.6</version>
</dependency>

for Pebble:

<dependency>
    <groupId>it.ozimov</groupId>
    <artifactId>spring-boot-pebble-email</artifactId>
    <version>0.3.6</version>
</dependency>

[FEATURE RELEASE] Added email scheduler

07 Jan 21:10
Compare
Choose a tag to compare

Email scheduling

The release introduce an email scheduler. The scheduler is defined by the interface SchedulerService (implemented with class PriorityQueueSchedulerService).

Scheduler service interface

The scheduler service interface is defined as follows:

public interface SchedulerService {

    /**
     * Schedules the sending of an email message.
     *
     * @param mimeEmail            an email to be sent
     * @param scheduledDateTime    the date-time at which the email should be sent
     * @param desiredPriorityLevel the desiredPriority level for the email:
     *                             the emails with scheduledTime<=now are sent according to an order depending
     *                             on their desiredPriority level
     */
    void schedule(Email mimeEmail, OffsetDateTime scheduledDateTime, int desiredPriorityLevel);

    /**
     * Schedules the sending of an email message.
     *
     * @param mimeEmail            an email to be sent
     * @param scheduledDateTime    the date-time at which the email should be sent
     * @param desiredPriorityLevel the desiredPriority level for the email:
     *                             the emails with scheduledTime<=now are sent according to an order depending
     *                             on their desiredPriority level
     * @param template             the reference to the template file
     * @param modelObject          the model object to be used for the template engine, it may be null
     * @param inlinePictures       list of pictures to be rendered inline in the template
     */
    void schedule(Email mimeEmail,
                  OffsetDateTime scheduledDateTime, int desiredPriorityLevel,
                  String template, Map<String, Object> modelObject,
                  InlinePicture... inlinePictures) throws CannotSendEmailException;


    default ServiceStatus status() {
        return ServiceStatus.CLOSED;
    }

}

As described in the interface, an email can be scheduled by providing an email, a date and a priority. It can be also used a template.

Scheduler service default implementation

The default implementation (PriorityQueueSchedulerService) has a parameter that should be defined via application.properties, i.e. spring.mail.scheduler.priorityLevels that creates priority levels for the emails. By default, 10 levels are used.

  • Whenever an email is scheduled for a level greater than spring.mail.scheduler.priorityLevels, the email is reassigned to the lowest-priority level. Level 1 has the highest-priority.
  • Whenever two emails should be sent at the same time, the one with highest-priority is sent first.