Set Up to Send Emails from Pleasanter Using AWS SES
Overview¶
This page describes how to configure email sending with the Amazon SES (Simple Email Service) V2 REST API so that the reminder and notification functions of Pleasanter can send email. Because authentication uses AWS Signature V4, you do not need to install the AWS SDK.
Cautions¶
- When changing the parameters of Mail.json, check "Confirmation When Changing Parameters".
- For security reasons, we recommend setting the AWS credentials in environment variables instead of writing them directly in "Mail.json". For details, refer to "2. Setting with Environment Variables (Recommended)" in the operation procedure.
- Temporary credentials (AssumeRole / IAM Role) have an expiration time. When you use an IAM role on EC2, ECS, Lambda, or the like, set values obtained dynamically through environment variables.
- After changing the settings of "Mail.json", you need to restart Pleasanter. The changes are not reflected until you restart it.
Prerequisites¶
- A valid AWS account is required.
- Amazon SES is enabled in the region to be used.
- The email address or domain used as the sender has been verified in SES.
- Prepare IAM credentials that have permission to send through SES. Choose one of the following according to the authentication method you use.
Method 1: Permanent keys of an IAM user…AccessKeyId and SecretAccessKey are required.
Method 2: Temporary credentials (AssumeRole / IAM Role)…AccessKeyId, SecretAccessKey, and SessionToken are required. -
The following policy is attached to the IAM user or role.
-
(Recommended) The SES sandbox has been lifted, and production access has been requested. In sandbox mode, you can send only to verified addresses.
Operation Procedure¶
1. Set Mail.json¶
Edit the configuration file Mail.json and specify AwsSes for Provider. Also set the credentials and the region in the AwsSes section.
Method 1: Using Permanent Keys of an IAM User¶
{
"Provider": "AwsSes",
"AwsSes": {
"AccessKeyId": "YOUR_AWS_ACCESS_KEY_ID",
"SecretAccessKey": "YOUR_AWS_SECRET_ACCESS_KEY",
"SessionToken": null,
"Region": "ap-northeast-1",
"ConfigurationSetName": null
},
"FixedFrom": "noreply@example.com",
"SupportFrom": "\"Support\" <support@example.com>"
}
Method 2: Using Temporary Credentials (AssumeRole / IAM Role)¶
{
"Provider": "AwsSes",
"AwsSes": {
"AccessKeyId": "YOUR_AWS_ACCESS_KEY_ID",
"SecretAccessKey": "YOUR_AWS_SECRET_ACCESS_KEY",
"SessionToken": "YOUR_AWS_SESSION_TOKEN",
"Region": "ap-northeast-1",
"ConfigurationSetName": null
},
"FixedFrom": "noreply@example.com",
"SupportFrom": "\"Support\" <support@example.com>"
}
Description of the Settings¶
| Parameter | Example | Description |
|---|---|---|
| Provider | "AwsSes" | Specify AwsSes to use AWS SES. |
| AwsSes.AccessKeyId | "YOUR_AWS_ACCESS_KEY_ID" | Specify the AWS access key ID. We recommend registering it in a system environment variable. |
| AwsSes.SecretAccessKey | "YOUR_AWS_SECRET_ACCESS_KEY" | Specify the AWS secret access key. We recommend registering it in a system environment variable. |
| AwsSes.SessionToken | "YOUR_AWS_SESSION_TOKEN" | Specify only when using temporary credentials (Method 2). Specify null when using permanent keys (Method 1). We recommend registering it in a system environment variable. |
| AwsSes.Region | "ap-northeast-1" | Specify the AWS region to use. |
| AwsSes.ConfigurationSetName | null | Specify the name of the SES configuration set. Specify null if you do not need to track metrics. |
| FixedFrom | "noreply@example.com" | Specify the from address used when sending email. |
| SupportFrom | "\"Support\" \<support@example.com>" | Specify the email address for support. |
For details of each parameter, refer to Mail.json.
2. Setting with Environment Variables (Recommended)¶
You can set the AWS credentials in environment variables instead of Mail.json. If a value is set in Mail.json, that value takes precedence.
Pleasanter gets the value from the environment variable only when the value in Mail.json is empty ("") or null.
Corresponding Environment Variables¶
| Target Parameter | Environment Variable Name (EnvironmentName Format) | Environment Variable Name (ServiceName Format) |
|---|---|---|
| AwsSes.AccessKeyId | {EnvironmentName}_Mail_AwsSes_AccessKeyId | {ServiceName}_Mail_AwsSes_AccessKeyId |
| AwsSes.SecretAccessKey | {EnvironmentName}_Mail_AwsSes_SecretAccessKey | {ServiceName}_Mail_AwsSes_SecretAccessKey |
| AwsSes.SessionToken | {EnvironmentName}_Mail_AwsSes_SessionToken | {ServiceName}_Mail_AwsSes_SessionToken |
{EnvironmentName} and {ServiceName} correspond to the settings of Service.json. The default ServiceName is Pleasanter.
Setting in PowerShell (Windows)¶
$env:Pleasanter_Mail_AwsSes_AccessKeyId = "YOUR_AWS_ACCESS_KEY_ID"
$env:Pleasanter_Mail_AwsSes_SecretAccessKey = "YOUR_AWS_SECRET_ACCESS_KEY"
# Only when using temporary credentials (Method 2)
$env:Pleasanter_Mail_AwsSes_SessionToken = "YOUR_AWS_SESSION_TOKEN"
Setting in bash (Linux or macOS)¶
export Pleasanter_Mail_AwsSes_AccessKeyId="YOUR_AWS_ACCESS_KEY_ID"
export Pleasanter_Mail_AwsSes_SecretAccessKey="YOUR_AWS_SECRET_ACCESS_KEY"
# Only when using temporary credentials (Method 2)
export Pleasanter_Mail_AwsSes_SessionToken="YOUR_AWS_SESSION_TOKEN"
3. Restart Pleasanter¶
Restart Pleasanter to reflect the changed settings.
In a Windows environment, restart IIS.
In a Linux environment, restart the service with the following command.
In a Microsoft Azure environment, restart App Service.
Supported Versions¶
| Supported versions | Body |
|---|---|
| 1.5.5.0 and later | Supports sending email with the Amazon SES V2 REST API |