Mail.json
Cautions¶
- In version 1.5.5.0 and later, the configuration method has changed with the addition of the Provider parameter. If you are migrating an existing environment, check the Provider parameter and the settings of each email sending provider below.
- When changing parameters, please refer to "Confirmation When Changing Parameters".
Setting Values¶
The setting values for this parameter file are as follows.
| Parameter name | e.g. | Description |
|---|---|---|
| Provider | "Smtp" | Specify the email sending provider: Smtp, SendGrid, or AwsSes. The default value is Smtp. |
| SmtpHost | "smtp.example.com" | Specify the address of the SMTP server. |
| SmtpPort | 25 | Specify the port of the SMTP server. |
| SmtpUserName | "user@example.com" | Specify the user name for SMTP-AUTH. Specify null if user authentication is not performed. Can be registered in system environment variables. |
| SmtpPassword | "Password" | Specify the password for SMTP-AUTH. Specify null if user authentication is not performed. Can be registered in system environment variables. |
| SmtpEnableSsl | false | Specify true to enable SSL/TLS. If set to true, the StartTls encryption method is applied. To use a different method, use SecureSocketOptions. |
| ServerCertificateValidationCallback | false | Specify true to suppress the error "An error occurred while attempting to establish an SSL or TLS connection". |
| SmtpCheckCertificateRevocation | true | Specify true or false to determine whether to check the revocation of the SMTP server certificate. |
| SecureSocketOptions | "SslOnConnect" | Specify the SSL/TLS encryption method to use for the connection. The default value is null. For allowed strings, refer to Enum Names available in MimeKit. |
| SmtpSslProtocols | null | See "Values of SmtpSslProtocols and SmtpProxySslProtocols" below. The default value is null. If an invalid value is specified, a warning is logged and the value is ignored. |
| SmtpTimeout | 120000 | Specify the timeout for SMTP communication (in milliseconds). |
| SmtpLocalDomain | null | Specify the local domain name of the SMTP client. |
| SmtpRequireTls | false | Specify true or false to determine whether to use the REQUIRETLS extension. |
| SmtpLocalEndPoint | "192.168.1.10:0" | Specify the local endpoint of the connection source as a string in the "IP address:port number" format. The default value is null. |
| SmtpProxyType | "Https" | Specify one of the following proxy types. The default value is null. Socks4: SOCKS4 proxy Socks4a: SOCKS4a proxy Socks5: SOCKS5 proxy Http: HTTP proxy Https: HTTPS proxy |
| SmtpProxyHost | "proxy.example.com" | Specify the host name or IP address of the proxy server. The default value is null. |
| SmtpProxyPort | 443 | Specify the proxy port number as a number. If 0 is specified, no proxy server is used. A value of 0 or less is treated as not set. The default value is 0. |
| SmtpProxyUserName | null | Specify the user name for proxy authentication. The default value is null. |
| SmtpProxyPassword | null | Specify the password for proxy authentication. The default value is null. |
| SmtpProxyServerCertificateValidationCallback | false | Valid only when SmtpProxyType is Https. Specify true or false to determine whether to skip validation of the HTTPS proxy certificate. The default value is false. true always passes certificate validation, so use it only for testing. |
| SmtpProxyCheckCertificateRevocation | true | Valid only when SmtpProxyType is Https. Specify true or false to determine whether to check the revocation of the HTTPS proxy certificate. The default value is true. |
| SmtpProxySslProtocols | null | Valid only when SmtpProxyType is Https. Specify the SSL/TLS protocols allowed for the HTTPS proxy connection from "Values of SmtpSslProtocols and SmtpProxySslProtocols". The default value is null. If an invalid value is specified, a warning is logged and the value is ignored. |
| SmtpProxyClientCertificate | See below | Valid only when SmtpProxyType is Https. Specify the client certificate for the HTTPS proxy connection as described in "Parameters of SmtpProxyClientCertificate and SmtpClientCertificate". |
| SmtpClientCertificate | See below | Specify the client certificate used when connecting to the SMTP server as described in "Parameters of SmtpProxyClientCertificate and SmtpClientCertificate". |
| UseOAuth | false | Specify true to use OAuth 2.0 authentication. Required when using the SMTP server of M365. For details, see "Configure Pleasanter to send mail using the SMTP server of M365". |
| OAuthClientId | "" | Client ID used for OAuth 2.0 authentication. For security reasons, registering it in system environment variables is recommended. |
| OAuthClientSecret | "" | Client secret used for OAuth 2.0 authentication. For security reasons, registering it in system environment variables is recommended. |
| OAuthScope | "https://outlook.office365.com/.default" | Scope used for OAuth 2.0 authentication. |
| OAuthGrantType | "client_credentials" | Grant type of OAuth 2.0 authentication. |
| OAuthTokenEndpoint | "https://login.microsoftonline.com/{tenant ID}/oauth2/v2.0/token" | Token endpoint URL of OAuth 2.0 authentication. |
| OAuthDefaultExpiresIn | 3600 | Token lifetime in seconds applied when the response from the token endpoint does not include expires_in. The default value is 3600 (1 hour). |
| OAuthTokenRefreshBufferTime | 300 | Buffer in seconds that specifies how many seconds before expiration a token is treated as due for renewal. The default value is 300 (5 minutes). For example, if OAuthDefaultExpiresIn is 3600, renewal is attempted 3300 seconds after the token is acquired. This prevents the token from expiring during sending and absorbs differences in responses between providers. |
| SendGrid | — | Set when using the SendGrid Web API. See "SendGrid". |
| AwsSes | — | Set when using the Amazon SES V2 REST API. See "AwsSes". |
| FixedFrom | "fixed@example.com" | If an email address is specified, it is used as the from address when sending email. If null is set, the email address of the logged-in user is used as the from address. For the behavior in each case, see "About FixedFrom and SupportFrom". |
| AllowedFrom | ["support@example.com"] | If FixedFrom is not null and the email address matches one listed in AllowedFrom, FixedFrom is not used and the email address of the logged-in user is used as the from address. |
| SupportFrom | "\"Pleasanter.org\" <support@pleasanter.org>" | Specify a support email address. Required when using "Enable 2-step Authentication by Email". It is also sent as BCC by "User Management Function: Invite User". For the behavior in each case, see "About FixedFrom and SupportFrom". |
| InternalDomains | ".example1.com,.example2.com" | To restrict the destination domains, specify a whitelist separated by commas. To not restrict them, specify an empty string. |
| Encoding | "shift_jis" | The default value is null. Specify explicitly if you want to change it to something other than UTF-8. If the system does not support the encoding name, an error is output to SysLogs when the settings are loaded, and sending is attempted in UTF-8. |
| ContentEncoding | "SevenBit" | The default value is null. For permitted strings, refer to Enum Names available in MimeKit. |
The email sending provider settings were added in version 1.5.5.0. For how to configure each email sending provider, see the following pages.
- Set Up To Send Emails From Pleasanter
- Configure Pleasanter to send mail using the SMTP server of M365
Values of SmtpSslProtocols and SmtpProxySslProtocols¶
| Value | Description |
|---|---|
| None | Leaves the protocol selection to the OS. Usually recommended. |
| Ssl2 | SSL 2.0. Obsolete. |
| Ssl3 | SSL 3.0. Obsolete. |
| Tls | TLS 1.0. Obsolete. |
| Default | Legacy compatibility value. Usually not recommended. |
| Tls11 | TLS 1.1. Obsolete. |
| Tls12 | TLS 1.2. |
| Tls13 | TLS 1.3. |
Example Settings¶
You can specify multiple values for SmtpSslProtocols and SmtpProxySslProtocols, separated by commas.
Parameters of SmtpProxyClientCertificate and SmtpClientCertificate¶
| Parameter name | e.g. | Description |
|---|---|---|
| StoreName | My | Specify the Windows certificate store to refer to from "Values of StoreName" below. The default value is "My". |
| StoreLocation | CurrentUser | Specify one of the following as the location of the certificate store. CurrentUser: Per user (default value) LocalMachine: Per local machine |
| X509FindType | FindByThumbprint | Specify the condition for searching certificates from "Values of X509FindType" below. The default value is "FindByThumbprint". |
| FindValue | null | Specify the value actually used for the search. If null or empty, no certificate is used. The default value is null. |
Values of StoreName¶
| Value | Description |
|---|---|
| AddressBook | Certificate store for other users |
| AuthRoot | Third-party CA store |
| CertificateAuthority | Intermediate CA store |
| Disallowed | Revoked certificate store |
| My | Personal certificate store |
| Root | Trusted root CA store |
| TrustedPeople | Certificate store for directly trusted people |
| TrustedPublisher | Trusted publisher store |
Values of X509FindType¶
| Value | Description |
|---|---|
| FindByThumbprint | Search by thumbprint |
| FindBySubjectName | Search by subject name |
| FindBySubjectDistinguishedName | Search by subject distinguished name |
| FindByIssuerName | Search by issuer name |
| FindByIssuerDistinguishedName | Search by issuer distinguished name |
| FindBySerialNumber | Search by serial number |
| FindByTimeValid | Search for certificates valid at the specified date and time |
| FindByTimeNotYetValid | Search for certificates not yet valid at the specified date and time |
| FindByTimeExpired | Search for certificates expired at the specified date and time |
| FindByTemplateName | Search by template name |
| FindByApplicationPolicy | Search by application policy |
| FindByCertificatePolicy | Search by certificate policy |
| FindByExtension | Search by extension |
| FindByKeyUsage | Search by key usage |
| FindBySubjectKeyIdentifier | Search by subject key identifier |
SendGrid¶
These parameters are used when using the SendGrid Web API. They are referred to when SendGrid is specified for Provider.
| Parameter name | e.g. | Description |
|---|---|---|
| ApiKey | "SG.xxxxAPIKeyxxxxxx..." | Specify the SendGrid API key. For security reasons, registering it in system environment variables is recommended. |
AwsSes¶
These parameters are used when using the Amazon SES V2 REST API. They are referred to when AwsSes is specified for Provider.
| Parameter name | e.g. | Description |
|---|---|---|
| AccessKeyId | "YOUR_AWS_ACCESS_KEY_ID" | AWS access key ID. For security reasons, registering it in system environment variables is recommended. |
| SecretAccessKey | "YOUR_AWS_SECRET_ACCESS_KEY" | AWS secret access key. For security reasons, registering it in system environment variables is recommended. |
| SessionToken | "YOUR_AWS_SESSION_TOKEN" | AWS session token. Specify only when using temporary credentials (AssumeRole / IAM Role). Specify null when using permanent keys. For security reasons, registering it in system environment variables is recommended. |
| Region | "ap-northeast-1" | Specify the AWS region to use. |
| ConfigurationSetName | null | Specify the name of the SES configuration set. Specify null if metrics tracking is not required. |
About FixedFrom and SupportFrom¶
When certain conditions are met, each of them is used as the sender email address of "Notifications", notifications by "Processes", "Email", and "Reminders". Note that an application error may occur depending on how each email address is set. The From value recorded in the Outgoingmails table of the database also differs depending on how each email address is set.
Notifications¶
| SupportFrom setting | FixedFrom setting | User email address setting | Sender of the sent email | Notes | (Reference) From in Outgoingmails |
|---|---|---|---|---|---|
| Set | Not set | Not set | SupportFrom | SupportFrom | |
| Set | Not set | Set | User email address | User email address | |
| Set | Set | Not set | FixedFrom | SupportFrom | |
| Set | Set | Set | FixedFrom | User email address | |
| Not set | Not set | Not set | - | Application error | - |
| Not set | Not set | Set | User email address | User email address | |
| Not set | Set | Not set | - | Application error | - |
| Not set | Set | Set | FixedFrom | User email address |
Notifications by Processes¶
| SupportFrom setting | FixedFrom setting | User email address setting | Sender of the sent email | Notes | (Reference) From in Outgoingmails |
|---|---|---|---|---|---|
| Set | Not set | Not set | SupportFrom | SupportFrom | |
| Set | Not set | Set | User email address | User email address | |
| Set | Set | Not set | FixedFrom | SupportFrom | |
| Set | Set | Set | FixedFrom | User email address | |
| Not set | Not set | Not set | - | Application error | - |
| Not set | Not set | Set | User email address | User email address | |
| Not set | Set | Not set | - | Application error | - |
| Not set | Set | Set | FixedFrom | User email address |
Email¶
| SupportFrom setting | FixedFrom setting | User email address setting | Sender of the sent email | Notes | (Reference) From in Outgoingmails |
|---|---|---|---|---|---|
| Set | Not set | Not set | - | Error: email address not set | - |
| Set | Not set | Set | User email address | User email address | |
| Set | Set | Not set | - | Error: email address not set | - |
| Set | Set | Set | FixedFrom | User email address | |
| Not set | Not set | Not set | - | Error: email address not set | - |
| Not set | Not set | Set | User email address | User email address | |
| Not set | Set | Not set | - | Error: email address not set | - |
| Not set | Set | Set | FixedFrom | User email address |
Reminders¶
| SupportFrom setting | FixedFrom setting | User email address setting | Sender of the sent email | Notes | (Reference) From in Outgoingmails |
|---|---|---|---|---|---|
| Set | Not set | Not set | "From" | "From" | |
| Set | Not set | Set | "From" | "From" | |
| Set | Set | Not set | FixedFrom | "From" field is hidden | FixedFrom |
| Set | Set | Set | FixedFrom | "From" field is hidden | FixedFrom |
| Not set | Not set | Not set | "From" | "From" | |
| Not set | Not set | Set | "From" | "From" | |
| Not set | Set | Not set | FixedFrom | "From" field is hidden | FixedFrom |
| Not set | Set | Set | FixedFrom | "From" field is hidden | FixedFrom |
How to Register in System Environment Variables¶
SmtpUserName, SmtpPassword, OAuthClientId, OAuthClientSecret, SendGrid.ApiKey, AwsSes.AccessKeyId, AwsSes.SecretAccessKey, and AwsSes.SessionToken can be registered in system environment variables. OAuthClientId and OAuthClientSecret can be registered in 1.5.1.0 and later, and SendGrid.ApiKey, AwsSes.AccessKeyId, AwsSes.SecretAccessKey, and AwsSes.SessionToken in 1.5.5.0 and later.
For OAuthClientId and OAuthClientSecret, also refer to "Configure Pleasanter to send mail using the SMTP server of M365".
Registering in system environment variables
Also refer to the following page for registration in system environment variables.
Register Credentials in System Environment Variables
1. Naming Convention¶
The naming convention of the system environment variables is as follows.
(Service name)_Mail_SmtpUserName
(Service name)_Mail_SmtpPassword
(Service name)_Mail_OAuthClientId
(Service name)_Mail_OAuthClientSecret
(Service name)_Mail_SendGrid_ApiKey
(Service name)_Mail_AwsSes_AccessKeyId
(Service name)_Mail_AwsSes_SecretAccessKey
(Service name)_Mail_AwsSes_SessionToken
| Column | Required | Description |
|---|---|---|
| Service name | ○ | Specify "EnvironmentName" or "Name" in Service.json |
You can also set these values in this parameter file as before. For Azure, you can add or edit them via [App Service Settings] -> [Configuration] -> [Application Settings].
Example Settings¶
| Variable | Example |
|---|---|
| Implem.Pleasanter_Mail_SmtpUserName | UserName |
| Implem.Pleasanter_Mail_SmtpPassword | Password |
| Implem.Pleasanter_Mail_OAuthClientId | ClientId |
| Implem.Pleasanter_Mail_OAuthClientSecret | ClientSecret |
| Implem.Pleasanter_Mail_SendGrid_ApiKey | SG.xxxxAPIKeyxxxxxx... |
| Implem.Pleasanter_Mail_AwsSes_AccessKeyId | AccessKeyId |
| Implem.Pleasanter_Mail_AwsSes_SecretAccessKey | SecretAccessKey |
| Implem.Pleasanter_Mail_AwsSes_SessionToken | SessionToken |
2. Priority Order¶
If a value is set in both this parameter file and the system environment, or if it is set in an abbreviated form, the priority is as follows.
| Priority order | Setting value |
|---|---|
| 1 | "SmtpUserName" in this parameter file |
| 2 | "(Service name: EnvironmentName)_Mail_SmtpUserName" in the environment variable |
| 3 | "(Service name: Name)_Mail_SmtpUserName" in the environment variable |
| Priority order | Setting value |
|---|---|
| 1 | "SmtpPassword" in this parameter file |
| 2 | "(Service name: EnvironmentName)_Mail_SmtpPassword" in the environment variable |
| 3 | "(Service name: Name)_Mail_SmtpPassword" in the environment variable |
| Priority order | Setting value |
|---|---|
| 1 | "OAuthClientId" in this parameter file |
| 2 | "(Service name: EnvironmentName)_Mail_OAuthClientId" in the environment variable |
| 3 | "(Service name: Name)_Mail_OAuthClientId" in the environment variable |
| Priority order | Setting value |
|---|---|
| 1 | "OAuthClientSecret" in this parameter file |
| 2 | "(Service name: EnvironmentName)_Mail_OAuthClientSecret" in the environment variable |
| 3 | "(Service name: Name)_Mail_OAuthClientSecret" in the environment variable |
| Priority order | Setting value |
|---|---|
| 1 | "SendGrid.ApiKey" in this parameter file |
| 2 | "(Service name: EnvironmentName)_Mail_SendGrid_ApiKey" in the environment variable |
| 3 | "(Service name: Name)_Mail_SendGrid_ApiKey" in the environment variable |
| 4 | The value of "SmtpPassword" in this parameter file (only when SmtpHost is "smtp.sendgrid.net" and Provider is "Smtp". The value of SmtpPassword is determined as described in "SmtpPassword Priority Order") |
| Priority order | Setting value |
|---|---|
| 1 | "AwsSes.AccessKeyId" in this parameter file |
| 2 | "(Service name: EnvironmentName)_Mail_AwsSes_AccessKeyId" in the environment variable |
| 3 | "(Service name: Name)_Mail_AwsSes_AccessKeyId" in the environment variable |
| Priority order | Setting value |
|---|---|
| 1 | "AwsSes.SecretAccessKey" in this parameter file |
| 2 | "(Service name: EnvironmentName)_Mail_AwsSes_SecretAccessKey" in the environment variable |
| 3 | "(Service name: Name)_Mail_AwsSes_SecretAccessKey" in the environment variable |
| Priority order | Setting value |
|---|---|
| 1 | "AwsSes.SessionToken" in this parameter file |
| 2 | "(Service name: EnvironmentName)_Mail_AwsSes_SessionToken" in the environment variable |
| 3 | "(Service name: Name)_Mail_AwsSes_SessionToken" in the environment variable |
3. Notes When Registering in System Environment Variables¶
As described in "2. Priority Order", the value set in the parameter file takes the highest priority. Therefore, when you register a value in a system environment variable, specify "null" or an empty string ("") in the parameter file.
Supported Versions¶
| Supported versions | Body |
|---|---|
| 1.3.18.0 and later | Added ServerCertificateValidationCallback |
| 1.3.49.0 and later | Added SecureSocketOptions |
| 1.5.1.0 and later | Added the following parameters ・UseOAuth ・OAuthClientId ・OAuthClientSecret ・OAuthScope ・OAuthGrantType ・OAuthTokenEndpoint ・OAuthDefaultExpiresIn ・OAuthTokenRefreshBufferTime Added the ability to register OAuthClientId and OAuthClientSecret in system environment variables |
| 1.5.5.0 and later | Added the following parameters ・Provider ・SendGrid (ApiKey) ・AwsSes (AccessKeyId, SecretAccessKey, SessionToken, Region, ConfigurationSetName) Added the ability to register SendGrid.ApiKey, AwsSes.AccessKeyId, AwsSes.SecretAccessKey, and AwsSes.SessionToken in system environment variables |
| 1.5.6.0 and later | Added the following parameters ・SmtpCheckCertificateRevocation ・SmtpSslProtocols ・SmtpTimeout ・SmtpLocalDomain ・SmtpRequireTls ・SmtpLocalEndPoint ・SmtpProxyType ・SmtpProxyHost ・SmtpProxyPort ・SmtpProxyUserName ・SmtpProxyPassword ・SmtpProxyServerCertificateValidationCallback ・SmtpProxyCheckCertificateRevocation ・SmtpProxySslProtocols ・SmtpProxyClientCertificate (StoreName, StoreLocation, X509FindType, FindValue) ・SmtpClientCertificate (StoreName, StoreLocation, X509FindType, FindValue) |