Skip to content

Commit 2adc310

Browse files
authored
Merge pull request #1 from V1ncNet/release/2.0.0
Release v2.0.0
2 parents 644a2fc + 5fa69c0 commit 2adc310

File tree

57 files changed

+3139
-391
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3139
-391
lines changed

.github/workflows/maven.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Java CI with Maven
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up AdoptOpenJDK 8
15+
uses: actions/setup-java@v2
16+
with:
17+
java-version: '8'
18+
distribution: 'adopt'
19+
- name: Cache local Maven repository
20+
uses: actions/cache@v2
21+
with:
22+
path: ~/.m2/repository
23+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
24+
restore-keys: |
25+
${{ runner.os }}-maven-
26+
27+
- name: Lint sources
28+
run: mvn -B checkstyle:check
29+
- name: Compile sources
30+
run: mvn -B compile test-compile
31+
- name: Run tests
32+
run: mvn -B test
33+
- name: Package artifact
34+
run: mvn -B -fae -DskipTests=true package
35+
36+
- name: Report Checkstyle results
37+
if: always()
38+
uses: jwgmeligmeyling/[email protected]
39+
with:
40+
path: '**/checkstyle-result.xml'
41+
- name: Report Surefire results
42+
if: always()
43+
uses: ScaCap/action-surefire-report@v1
44+
45+
- name: Aggregate JavaDoc
46+
if: github.ref == 'refs/heads/main'
47+
run: mvn -B javadoc:aggregate
48+
- name: Deploy API docs
49+
if: github.ref == 'refs/heads/main'
50+
uses: JamesIves/[email protected]
51+
with:
52+
branch: gh-pages
53+
folder: target/site/apidocs

.gitignore

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
### Maven ###
22
target/
3+
pom.xml.tag
4+
pom.xml.releaseBackup
5+
pom.xml.versionsBackup
6+
pom.xml.next
7+
release.properties
8+
dependency-reduced-pom.xml
9+
buildNumber.properties
310

411
### IntelliJ IDEA ###
5-
.idea
6-
*.iws
712
*.iml
8-
*.ipr
9-
10-
### VS Code ###
11-
.vscode/
12-
13-
### MacOS ###
14-
.DS_Store

.idea/.gitignore

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/Project.xml

+28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/codeStyleConfig.xml

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/encodings.xml

+17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Apache License
22
Version 2.0, January 2004
3-
http://www.apache.org/licenses/
3+
https://www.apache.org/licenses/
44

55
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
66

@@ -186,13 +186,13 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright 2021 Vincent Nadoll
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.
193193
You may obtain a copy of the License at
194194

195-
http://www.apache.org/licenses/LICENSE-2.0
195+
https://www.apache.org/licenses/LICENSE-2.0
196196

197197
Unless required by applicable law or agreed to in writing, software
198198
distributed under the License is distributed on an "AS IS" BASIS,

README.md

+87-27
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,80 @@
1-
Spring Boot DKIM JavaMail
2-
===
1+
# Spring Boot Mail Extensions
32

4-
This project provides an easy way to digitally sign your emails. Therefore, this project uses the
5-
[java-utils-mail-dkim](https://github.com/markenwerk/java-utils-mail-dkim) library from Markenwerk and extends Spring's
6-
JavaMailSender to sign MIME messages before they were transported to the SMTP server. To verify the signed parts of the
7-
email you must configure your DNS. This authentication method is called DKIM (DomainKeys Identified Mail).
3+
This project aims to extend Spring's `JavaMailSender` with useful features. Therefore, the library provides two advanced
4+
sender extensions. Library and starters are compatible with Spring Framework >5.2.x and Spring Boot >2.2.x
5+
6+
7+
## Library
8+
9+
The library currently provides two combinable sender implementations.
10+
11+
The `DkimJavaMailSender` uses Markenwerk's [java-utils-mail-dkim](https://github.com/markenwerk/java-utils-mail-dkim)
12+
library and extends Spring's `JavaMailSender` to sign MIME messages before they were transported to the SMTP server. To
13+
verify the signed parts of the email you must configure your DNS. This authentication method is called **DKIM**
14+
(DomainKeys Identified Mail). In case you are not using the starter, you must configure the `DkimSigner` yourself.
15+
16+
The `ConcurrentJavaMailSender` enqueues any supported MIME message to be sent immediately or after a configurable
17+
cooldown. By splitting potential large amounts of messages into smaller batches your application is capable of **dealing
18+
with** common problems or restrictions of your SMTP server or provider, like **rate limits**. The dispatch happens on
19+
another thread, so you don't block your main thread in case of a **slow SMTP server**.
820

921

1022
## Usage
1123

12-
Include the `spring-boot-starter-dkim-javamail` dependency in your `pom.xml` and adjust your `application.properties` or
13-
`application.yml` as described in [Configuration](#Configuration).
24+
This project provides 4 artifacts. Depending on your scope and infrastructure you may want just the library. Include
25+
the `mail-extensions` and `utils-mail-dkim` libraries in your Spring Project **in case you don't want or can use the
26+
Starters**. Adjust your `pom.xml` as followed:
27+
28+
```xml
29+
<dependency>
30+
<groupId>de.vinado.spring</groupId>
31+
<artifactId>mail-extensions</artifactId>
32+
<version>2.0.0</version>
33+
</dependency>
34+
<dependency>
35+
<groupId>net.markenwerk</groupId>
36+
<artifactId>utils-mail-dkim</artifactId>
37+
<version>1.4.0</version>
38+
</dependency>
39+
```
40+
41+
---
42+
43+
Those who use Spring Boot can choose between 3 Spring Boot starters.
44+
45+
1. `mail-extensions-concurrent-javamail-spring-boot-starter`
46+
2. `mail-extensions-dkim-javamail-spring-boot-starter`
47+
3. `mail-extensions-all-spring-boot-starter`
48+
49+
Include one of the above in your `pom.xml` and adjust your `application.properties` or `application.yml` as described in
50+
[Configuration](#Configuration).
1451

1552
The starter, as well as the other artifacts are hosted in the
16-
[Maven Central Repository](https://search.maven.org/artifact/de.vinado.boot/spring-boot-starter-dkim-javamail/1.2.2/jar).
17-
You can use it with the following coordinates:
53+
[Maven Central Repository](https://search.maven.org/artifact/de.vinado.boot/mail-extensions-spring-boot/2.0.0/pom).
54+
You can use it with one of the following coordinates:
1855

1956
```xml
2057
<dependency>
2158
<groupId>de.vinado.boot</groupId>
22-
<artifactId>spring-boot-starter-dkim-javamail</artifactId>
23-
<version>1.2.2</version>
59+
<artifactId>mail-extensions-concurrent-javamail-spring-boot-starter</artifactId>
60+
<version>2.0.0</version>
61+
</dependency>
62+
63+
<dependency>
64+
<groupId>de.vinado.boot</groupId>
65+
<artifactId>mail-extensions-dkim-javamail-spring-boot-starter</artifactId>
66+
<version>2.0.0</version>
67+
</dependency>
68+
69+
<dependency>
70+
<groupId>de.vinado.boot</groupId>
71+
<artifactId>mail-extensions-all-spring-boot-starter</artifactId>
72+
<version>2.0.0</version>
2473
</dependency>
2574
```
2675

27-
Version `v1.0.0` is still available in the
28-
[JitPack repository](https://jitpack.io/#V1ncNet/spring-boot-dkim-javamail/v1.0.0).
76+
Version `v1.x` is still available in an archived [Git repository](https://github.com/V1ncNet/spring-boot-dkim-javamail).
77+
2978

3079
## Setup
3180

@@ -37,32 +86,43 @@ setup instructions on how to create an RSA keypair and properly configure DNS.
3786

3887
### Configuration
3988

40-
The starter uses auto configuration to avoid Java-based adjustments. The mandatory configuration looks like this:
89+
The starter uses autoconfiguration to avoid Java-based adjustments. The mandatory configuration looks like this:
4190

4291
```properties
43-
dkim.signing-domain=domain.tld
44-
dkim.selector=default
45-
dkim.private-key=file:/path/to/your/private.key.der
46-
#dkim.private-key=classpath:/path/to/your/private.key.der
47-
#dkim.private-key=/path/to/your/private.key.der
92+
javamail.dkim.signing-domain=domain.tld
93+
javamail.dkim.selector=default
94+
javamail.dkim.private-key=file:/path/to/your/private.key.der
95+
#javamail.dkim.private-key=classpath:/path/to/your/private.key.der
4896
```
4997

5098
The example assumes your TXT record uses the domain `default._domainkey.domain.tld`. The following example contains
5199
optional properties which configures the DKIM signer itself:
52100

53101
```properties
54-
dkim.signer.identity=
55-
dkim.signer.header-canonicalization=SIMPLE
56-
dkim.signer.body-canonicalization=RELAXED
57-
dkim.signer.signing-algorithm=SHA256_WITH_RSA
58-
dkim.signer.length-param=true
59-
dkim.signer.copy-header-fields=false
60-
dkim.signer.check-domain-key=true
102+
javamail.dkim.signer.identity=
103+
javamail.dkim.signer.header-canonicalization=SIMPLE
104+
javamail.dkim.signer.body-canonicalization=RELAXED
105+
javamail.dkim.signer.signing-algorithm=SHA256_WITH_RSA
106+
javamail.dkim.signer.length-param=true
107+
javamail.dkim.signer.copy-header-fields=false
108+
javamail.dkim.signer.check-domain-key=true
61109
```
62110

63111
To learn more about the identity and canonicalization read the [specification](https://tools.ietf.org/html/rfc6376)
64112
about DKIM.
65113

114+
---
115+
116+
The concurrent sender can be configured as follows. This sender is deactivated by default.
117+
118+
```properties
119+
javamail.concurrent.enabled=true
120+
javamail.concurrent.batch-size=20
121+
# 20 seconds cooldown
122+
javamail.concurrent.cooldown-millis=20000
123+
```
124+
125+
66126
## Licence
67127

68128
Apache License 2.0 - [Vinado](https://vinado.de) - Built with :heart: in Dresden

0 commit comments

Comments
 (0)