Skip to content

bootique/bootique-simplejavamail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

151 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

build test deploy Maven Central

bootique-simplejavamail

Provides Simple Java Mail integration with Bootique.

Usage

Include bootique-bom:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.bootique.bom</groupId>
            <artifactId>bootique-bom</artifactId>
            <version>4.0-M4</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

Import Simple Java Mail integration:

<dependency>
	<groupId>io.bootique.simplejavamail</groupId>
	<artifactId>bootique-simplejavamail</artifactId>
</dependency>

Configure the app:

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:

@Inject
Mailers mailers;

public void sendMail() {
    Email email = EmailBuilder.startingBlank()
        .from("me@example.org")
        .to("you@example.org")
        .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);
}

About

Provides Simple Java Mail integration with Bootique

Topics

Resources

License

Stars

0 stars

Watchers

7 watching

Forks

Packages

 
 
 

Contributors

Languages