EmailService

The EmailService provides the ability to send HTML emails, with attachments, to one or more recipients.

The framework provides a default implementation to send emails using an external SMTP provider.

API

EmailService.java
interface EmailService {
  void init()
  boolean send(List<String> to, List<String> cc, List<String> bcc, String subject, String body, DataSource... attachments)     (1)
  boolean isConfigured()     (2)
}
1 send(List, List, List, String, String, DataSource)

The main API to send the email (and optional attachments).

2 isConfigured()

Whether this service has been configured and thus available for use.

Members

send(List, List, List, String, String, DataSource)

The main API to send the email (and optional attachments).

isConfigured()

Whether this service has been configured and thus available for use.

Implementation

The Core Runtime Services module provides a default implementation, EmailServiceDefault. This sends email as an HTML message, using an external SMTP provider.

Configuration Properties

The default implementation (EmailServiceDefault) defines a number of configuration properties, under the causeway.core.runtime-services.email key.

It also requires that an implementation of Spring’s JavaMailSender is present on the classpath. This requires its own configuration.

Alternative Implementations

If you wish to write an alternative implementation, be aware that it should process the message body as HTML (as opposed to plain text or any other format).

The email service is used by the EmailNotificationService which is, in turn, used by UserRegistrationService.