Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.

Mail API

fschoeppl edited this page Jun 19, 2012 · 1 revision

The org.backmeup.utilities project contains the Mailer class which is based on the JavaMail API.

Setup

Add following maven dependency to the project:

<dependency>
  <groupId>org.backmeup</groupId>
  <artifactId>utilities</artifactId>
  <version>${project.version}</version>
</dependency>

Configuration

The Mailing Utiltiy must be configured within the Mailing Configuration File. An example is shown below:

mail.smtp.host=SMTP_SERVER
mail.user=USERNAME
mail.from=FROM
mail.password=PASSWORD
mail.smtp.port=PORT
mail.smtp.starttls.enable=USE_TLS (true|false)
mail.smtp.debug=true|false
mail.smtp.auth=true
mail.smtp.socketFactory.port=PORT
mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
mail.smtp.socketFactory.fallback=false

Further configuration options can be found in the JavaMail API Specification

Usage

To use the Mailer, simply run following code:

import org.backmeup.utilities.mail.Mailer;
...
Mailer.send(toEmail, subject, textMessage);
Clone this wiki locally