forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send SentMail Instances When Sending Emails
This commit introduces the use of CDI events to emit instances of SentMail whenever an email is successfully sent. The SentMail class is an immutable representation of the sent email, preventing unintended modifications. By leveraging CDI events, this approach avoids the need to introduce a new API. Fixes quarkusio#45135.
- Loading branch information
1 parent
0396c33
commit 8d58795
Showing
3 changed files
with
101 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
extensions/mailer/runtime/src/main/java/io/quarkus/mailer/SentMail.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.quarkus.mailer; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* Represents a sent mail. | ||
* Instances of this class are sent using CDI events. | ||
* | ||
* @param from the sender address | ||
* @param to the list of recipients | ||
* @param cc the list of CC recipients | ||
* @param bcc the list of BCC recipients | ||
* @param replyTo the list of reply-to addresses | ||
* @param bounceAddress the bounce address | ||
* @param subject the subject | ||
* @param textBody the text body | ||
* @param htmlBody the HTML body | ||
* @param headers the headers | ||
* @param attachments the attachments | ||
*/ | ||
public record SentMail(String from, | ||
List<String> to, List<String> cc, List<String> bcc, | ||
String replyTo, String bounceAddress, | ||
String subject, String textBody, String htmlBody, | ||
Map<String, List<String>> headers, List<Attachment> attachments) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters