Skip to content

Latest commit

 

History

History
38 lines (25 loc) · 980 Bytes

File metadata and controls

38 lines (25 loc) · 980 Bytes

optionfactory-spring/email

Email spooling, templating and inlining. This module provides a robust way to send emails by decoupling email generation from delivery using a file-system based spool.

Maven

<dependency>
    <groupId>net.optionfactory.spring</groupId>
    <artifactId>email</artifactId>
</dependency>

Usage

EmailSender

The EmailSender component is responsible for sending emails stored as .eml files in the spool directory.

EmailPaths paths = EmailPaths.provide(Paths.get("/tmp/emails/spool"), Paths.get("/tmp/emails/sent"), Paths.get("/tmp/emails/dead"));
EmailSenderConfiguration conf = ...;
EmailSender sender = new EmailSender(paths, conf);

// Process the spool and send emails
sender.processSpool();

CSS Inliner

The CssInliner can be used to inline CSS into HTML email bodies for better client compatibility.

CssInliner inliner = new CssInliner();
String inlinedHtml = inliner.inline(htmlBody);