Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/bootique/bootique-simplejavamail

Provides Simple Java Mail integration with Bootique
https://github.com/bootique/bootique-simplejavamail

bootique javamail

Last synced: about 2 months ago
JSON representation

Provides Simple Java Mail integration with Bootique

Awesome Lists containing this project

README

        

[![build test deploy](https://github.com/bootique/bootique-simplejavamail/actions/workflows/maven.yml/badge.svg)](https://github.com/bootique/bootique-simplejavamail/actions/workflows/maven.yml)
[![Maven Central](https://img.shields.io/maven-central/v/io.bootique.simplejavamail/bootique-simplejavamail.svg?colorB=brightgreen)](https://search.maven.org/artifact/io.bootique.simplejavamail/bootique-simplejavamail/)

# bootique-simplejavamail

Provides [Simple Java Mail](http://www.simplejavamail.org/) integration with [Bootique](https://bootique.io).

## Usage

Include ```bootique-bom```:
```xml



io.bootique.bom
bootique-bom
3.0-M4
pom
import

```
Import Simple Java Mail integration:
```xml

io.bootique.simplejavamail
bootique-simplejavamail

```

Configure the app:
```yaml
simplejavamail:

# Mail delivery is disabled by default to prevent inadvertent spamming when the app is in development. This property
# needs to be flipped to "false" if you want mail to be actually sent to someone.
disabled: false

# Configure named mailers. If "mailers" section is absent, the default mailer is created pointing to "localhost:25"
mailers:
main: # arbitrary name of the mailer
smtpServer: example.org
smtpPort: 3025
transportStrategy: SMTPS
```

Send mail:
```java
@Inject
Mailers mailers;

public void sendMail() {
Email email = EmailBuilder.startingBlank()
.from("[email protected]")
.to("[email protected]")
.withSubject("Hi!")
.withPlainText("Hello world..")
.buildEmail();

// if only one mailer is configured in YAML, it is assumed to be the default mailer
mailers.getDefaultMailer().sendMail(email, false);
}
```