Skip to content

Mail and notifications#

All Empowerment Center email goes out through a single SMTP server of the organization: subscriptions, data alerts, operations console notifications, scheduling notifications and the notice to the holder of a service credential that is about to expire. This page explains how that server and each type of notification are configured. Which emails ECenter sends and how to diagnose a delivery that does not arrive is in Operations.

The mail server#

The configuration goes in the backend's environment variables (in deploy/.env with Docker Compose) and applies when it is recreated (docker compose -f deploy/compose.yaml up -d backend).

Variable Property What it is
SPRING_MAIL_HOST spring.mail.host The server. Without it no email is sent.
SPRING_MAIL_PORT spring.mail.port The port: usually 587 with STARTTLS, 465 with direct TLS or 25 on an internal relay.
SPRING_MAIL_USERNAME spring.mail.username The user, if the server requires authentication.
SPRING_MAIL_PASSWORD spring.mail.password Its password.
SPRING_MAIL_PROTOCOL spring.mail.protocol smtp (by default) or smtps (TLS from the start, usually on 465).
SPRING_MAIL_PROPERTIES_MAIL_SMTP_AUTH spring.mail.properties.mail.smtp.auth true if the server requires authentication. With smtps, SPRING_MAIL_PROPERTIES_MAIL_SMTPS_AUTH.
SPRING_MAIL_PROPERTIES_MAIL_SMTP_STARTTLS_ENABLE spring.mail.properties.mail.smtp.starttls.enable true to encrypt with STARTTLS.
ECENTER_MAIL_FROM ecenter.notifications.from The sender of what does not give its own (ecenter@example.org). Empty, the one the server sets.
SPRING_MAIL_HOST=smtp.example.org
SPRING_MAIL_PORT=587
SPRING_MAIL_USERNAME=ecenter@example.org
SPRING_MAIL_PASSWORD=change-this-key
SPRING_MAIL_PROPERTIES_MAIL_SMTP_AUTH=true
SPRING_MAIL_PROPERTIES_MAIL_SMTP_STARTTLS_ENABLE=true
ECENTER_MAIL_FROM=ecenter@example.org
SPRING_MAIL_HOST=smtp.example.org
SPRING_MAIL_PORT=465
SPRING_MAIL_PROTOCOL=smtps
SPRING_MAIL_USERNAME=ecenter@example.org
SPRING_MAIL_PASSWORD=change-this-key
SPRING_MAIL_PROPERTIES_MAIL_SMTPS_AUTH=true
ECENTER_MAIL_FROM=ecenter@example.org
SPRING_MAIL_HOST=relay.example.org
SPRING_MAIL_PORT=25
ECENTER_MAIL_FROM=ecenter@example.org

Important

If you are not going to use email, remove or comment out SPRING_MAIL_HOST: do not leave it empty. An empty variable counts as defined.

Without a mail server, everything else works: Send me a test appears disabled (“This installation has no mail server”) and Administration › Operations › Policies says, under Email notifications, Mail server: Not configured (spring.mail.host). With one, it says Configured.

Each email carries the Auto-Submitted: auto-generated header, so that servers do not reply with out-of-office notices.

Timeouts#

Without timeouts, a server that accepts the connection and does not respond would leave deliveries hanging. ECenter comes with these, in milliseconds:

Property Default What it is
spring.mail.properties.mail.smtp.connectiontimeout 10000 Opening the connection.
spring.mail.properties.mail.smtp.timeout 60000 Each read.
spring.mail.properties.mail.smtp.writetimeout 60000 Each write (a large attachment is written in several).

With SPRING_MAIL_PROTOCOL=smtps the same ones apply with smtps instead of smtp, which are also set. They are changed one by one, without losing the others:

SPRING_MAIL_PROPERTIES_MAIL_SMTP_CONNECTIONTIMEOUT=5000
SPRING_MAIL_PROPERTIES_MAIL_SMTP_TIMEOUT=30000
SPRING_MAIL_PROPERTIES_MAIL_SMTP_WRITETIMEOUT=120000

With smtps, write SMTPS instead of SMTP in the variable name.

Checking the server#

While there are active subscriptions or data alerts, each round of operations console alerts (every minute) checks that the mail server responds within 10 s (ecenter.operations.alerts.mail-timeout): it connects, identifies itself and closes, without sending anything. If it does not respond, it opens the critical alert No mail server, which resolves itself when it responds again.

Operations console notifications#

The operations console can notify by email when an operational alert opens or resolves (the license, memory, disk, an unreachable client database, failing jobs…).

Property Default What it is
ecenter.operations.notifications.mode NONE What is notified: NONE, nothing; CRITICAL, the critical alerts, when they open and when they resolve; ALL, all of them, and also each backend startup.
ecenter.operations.notifications.recipients (none) To whom. Without recipients nothing is notified, even if there is a mode.
ecenter.operations.notifications.from (the general one) The sender of these notifications.
ecenter:
  operations:
    notifications:
      mode: CRITICAL
      recipients: [sistemas@example.org, guardia@example.org]

Which alerts there are and when they fire is in Operations.

Scheduling notifications#

The scheduler can notify the result of each run of a scheduled task.

Property Default What it is
ecenter.scheduling.notifications.mode NONE NONE, nothing; ALL, each run; FAILURES, only those that fail or are skipped (a run stopped by hand is not a failure).
ecenter.scheduling.notifications.recipients (none) To whom.
ecenter.scheduling.notifications.from (the general one) The sender.

See Scheduling.

Subscriptions and data alerts#

Subscriptions send calculated documents as each recipient; data alerts notify when a figure meets a rule. They share this configuration:

Property Default What it is When to change it
ecenter.distribution.enabled true Launch the scheduled ones automatically. With false, only recalculation and publication events trigger them. To stop them in a test installation.
ecenter.distribution.tick 15s How often the scheduled ones are looked at. It is not usually necessary.
ecenter.distribution.zone The server's (TZ) The zone of the schedules and of the dates in the email. If you cannot change TZ. It should match ecenter.scheduling.zone.
ecenter.distribution.base-url ECENTER_PUBLIC_URL The address for the links in emails. Without it, there are no links and no “link” format. Never, if ECENTER_PUBLIC_URL is right.
ecenter.distribution.attachments true With false, only links: data never goes out by email. If the organization's policy does not allow data in email.
ecenter.distribution.allowed-domains (all) The email domains that can receive (example.org). So that data does not go out to external addresses.
ecenter.distribution.max-recipients 100 Recipients (users and roles) of a subscription.
ecenter.distribution.max-per-owner 50 Subscriptions per owner.
ecenter.distribution.max-attachment 10MB Above it, the link is sent instead of the attachment. According to what the mail server accepts.
ecenter.distribution.max-groups 20 Calculation groups (different combinations of privileges among the recipients) of a send. More make the send fail, so as not to multiply the load on the client database.
ecenter.distribution.failures-to-pause 3 Consecutive failed sends after which a subscription pauses itself and notifies its owner.
ecenter.distribution.history 90d How long sends are kept in the history.
ecenter.distribution.mail-retries 5s, 30s The waits before each retry of an email that fails transiently. If a send exhausts its retries, its other emails are tried once.
ecenter.distribution.instance-name ECENTER_INSTANCE_NAME The name of the instance in sends.
ecenter.distribution.alerts.enabled true Evaluate data alerts. With false, none is evaluated.
ecenter.distribution.alerts.max-per-owner 50 Alerts per owner.
ecenter.distribution.alerts.max-values 5 Values watched per alert (from 1 to 26).
ecenter.distribution.alerts.max-rules 10 Rules per alert.
ecenter.distribution.alerts.max-instances 100 Instances per recipient in an alert “for each value of” a dimension.
ecenter.distribution.alerts.max-pending 10 The maximum of the waits to fire and to resolve (from 1 to 100).
ecenter.distribution.alerts.errors-to-pause 3 Consecutive evaluations that fail due to a system error before the alert pauses itself and notifies its owner.

Deliveries are jobs of the DELIVERY class (2 at a time by default; see Resources). The operations console warns if 3 sends or evaluations fail within an hour (ecenter.operations.alerts.delivery-failures and delivery-failures-window).

Service credential notices#

The holder of a personal credential (of the query API or the MCP) receives an email 14 days before it expires (ecenter.security.credentials.expiry-notice), if they have an email. SCIM, embedding and metadata exchange credentials do not notify their holder: they are watched by the operational alert Service credential about to expire, which opens 30 days before (ecenter.operations.alerts.credential-expiry) and goes out by email with the console notifications. See Integrations.

Users' email#

Users receive email at the address in their record, in Administration › Users and roles. It is optional and cannot be repeated between users. A user without an address receives no subscriptions or notifications. With single sign-on, the identity provider can fill it in.

See also#