Addons

Nuxeo Mail Amazon SES

Updated: December 5, 2024

The Nuxeo Mail Amazon SES addon allows you to send mails via AWS SES. To do so, it adds a Nuxeo MailSender implementation specific to Amazon SES which overrides the "default" SMTPMailSender and leverages the Nuxeo MailService.

Before You Start

You should be familiar with Amazon AWS and in possession of your credentials and region. You should also be familiar with SES reputation and identity verification.

Knowing how to use the SES Simulator and being aware of the SES sandbox limitations is a nice-to-have.

Installation

This addon requires no specific installation steps. It can be installed like any other package with nuxeoctl command line or from the Marketplace.

The ses template leverages the aws template and its configuration (see below).

Nuxeo Configuration

To configure the package, you will need to provide values for some configuration parameters defined in the aws template. You can configure the package using the nuxeo.conf properties described below.

Specifying Your AWS Credentials and Region

Default AWS Credentials and Region

By default, Nuxeo will get your "default" configuration by leveraging the following properties in nuxeo.conf:

nuxeo.aws.accessKeyId=your_AWS_ACCESS_KEY_ID
nuxeo.aws.secretKey=your_AWS_SECRET_ACCESS_KEY
nuxeo.aws.region=your_AWS_REGION

However, if those are not set, the fallback mechanism will use the DefaultAWSCredentialsProviderChain. So it will first look for the following envs (and so on with the fallbacks):

AWS_ACCESS_KEY_ID=your_AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY=your_AWS_SECRET_ACCESS_KEY
AWS_REGION=your_AWS_REGION

SES specific AWS Credentials

You can also use specific AWS Credentials with SES. To do so, you need to contribute a configuration on the following extension:

<extension target="org.nuxeo.runtime.aws.AWSConfigurationService" point="configuration">
  <configuration id="mySESspecificConfigId">
    <accessKeyId>your_AWS_ACCESS_KEY_ID</accessKeyId>
    <secretKey>your_AWS_SECRET_ACCESS_KEY</secretKey>
    <region>your_AWS_REGION</region>
  </configuration>
</extension>

Then you need to point to that configuration in your nuxeo.conf:

nuxeo.ses.aws.configuration.id=mySESspecificConfigId

Default mail.from

The default SESMailSender configuration will send mails from your mail.from nuxeo.conf property. This can be customized by contributing a custom SESMailSender.

Contributing a custom SESMailSender

The Nuxeo Mail Amazon SES addon can be customized by contributing to the MailServiceComponent's senders extension point. You can specify the following properties:

  • awsConfigurationId (if absent, "default" will be used)
  • mail.from (required, verified email)

Here is an example of contribution:

<?xml version="1.0"?>
<component name="org.acme.mail.component" version="1.0">
  <!-- uncomment this if you wish to override your SES default configuration but then the sender name attribute should be "default" -->
  <!-- <require>org.nuxeo.mail.sender.amazon.ses</require> -->
  <extension target="org.nuxeo.mail.MailServiceComponent" point="senders">
    <!-- The name attribute identifies the sender, if you override the default sender, set it to "default" -->
    <sender name="myCustomSender" class="org.nuxeo.mail.amazon.ses.SESMailSender">
      <!-- if absent, your "default" aws configuration will be used -->
      <property name="awsConfigurationId">myCustomConfig</property>
      <!-- required, the mail.from your sender will use by default -->
      <property name="mail.from">[email protected]</property>
    </sender>
  </extension>
</component>

To use your "myCustomSender", you need to set it when building the mails:

// Builds a mail to [email protected] from your default mail.from with the default sender. The default mail.from can be set up in nuxeo.conf.
new MailMessage.Builder("[email protected]").build();
// Builds a mail to [email protected] from [email protected] with the myCustomSender sender.
new MailMessage.Builder("[email protected]").from("[email protected]").sender("myCustomSender").build();