This is an internal documentation. There is a good chance you’re looking for something else. See Disclaimer.

Outgoing Mail in Nice

Set Default Sender

Tip

For installations managed via Ansible, set mail_sender_default instead, see Configure Default Sender Addresses. Ansible will, in turn, set this property correctly.

The application property email.default.from defines the global fallback sender address. It is used for mails whose sender domain isn’t an active mail domain, see next section, or if no sender address is available.

email.default.from=noreply@tocco.ch

Allow Domains in Outgoing Mails

Tip

For installations managed via Ansible, set mail_domains instead, see Configure Email Sender Domains. Ansible will, in turn, set this property correctly.

Domains are registered and activated using the entity Mail_domain (Settings → System → Email templates → E-Mail Domain). Create a new Mail_domain and you land on the detail of your newly created entity. Here, you can see your validation results for the SPF, DKIM, DMARC and tocco-verification-code together with the suggested entries. Then, create or update those entries accordingly. Finally, you can revalidate and activate the mail domain via the action E-Mail-Domain aktivieren.

The DMARC record is always checked, but it only has to pass the validation if DMARC Eintrag überprüfen is set. Once active, a domain is allowed as From in emails. Mails sent from a non-activated or non-registered domain are rewritten to the mail address specified on the business unit, if any, and email.default.from otherwise. Subdomains need to be registered as their own mail domain.

Hint

After creating the mail domain, reload the page to see the current status on the form.

The following records are required, see DNS Records for Outgoing Mails for details:

Record

Type

Name

Value

Verification

TXT

_tocco_email-challenge.<domain>

tocco-verification-code=<verification code>

SPF

TXT

<domain>

existing record extended by include:spf.tocco.ch (see Vorgeschlagener Wert on the form)

DKIM

CNAME

ch-tocco-1._domainkey.<domain>

ch-tocco-1._domainkey.tocco.ch

DKIM

CNAME

ch-tocco-2._domainkey.<domain>

ch-tocco-2._domainkey.tocco.ch

DMARC

TXT

_dmarc.<domain>

v=DMARC1; p=none

Warning

After creating the DNS records, it may take up to one minute until those changes reach our application, because the DNS server caches records for up to one minute.

Check DNS Records of Mail Domains

The SPF, DKIM, DMARC and verification DNS records of a mail domain are checked:

  • when the mail domain is created,

  • when the action E-Mail-Domain aktivieren is run (the domain is activated if the checks pass) and

  • regularly by the batch job DnsRecordValidationBatchJob, for all active mail domains. A mail domain whose records no longer pass validation is deactivated. It is not checked again automatically. Once the records are corrected, run the action again. If the DNS servers cannot be reached, nothing is changed.

Important

email.spf.sendingIp (the outgoing IP address of the installation’s mail server) is not set by default and has to be set for every installation. As long as it isn’t set, no mail domain can be activated, and the batch job leaves all mail domains unchanged.

All other properties of the checks have working defaults.

Note

If email.skipDnsRecordCheck is set to true, the action E-Mail-Domain aktivieren activates the mail domain without checking its records, and the batch job doesn’t check any mail domain.

Rewrite Recipient Addresses

Tip

For installations managed via Ansible, set mail_allowed_recipients_enabled and mail_allowed_recipients instead, see Restrict Allowed Mail Recipients. Ansible will, in turn, set this property correctly.

The recipientrewrite.mappings application property can be used to rewrite recipient addresses.

The syntax is very simple:

recipientrewrite.mappings=ORIGINAL -> REDIRECT1[, REDIRECT2]...[; ORIGINAL -> REDIRECT1[, REDIRECT2]...]...

ORIGINAL

Recipient address before rewriting. To, Cc and Bcc addresses rewritten.

REDIRECTED1..

Rewrite rule for the address. You can specify multiple REDIRECT rules to have the mail redirected to multiple addresses at once.

Rewrite All Recipients

A single asterisk (*) can be used to redirect all mails.

recipientrewrite.mappings=* -> fallback@tocco.ch

Rewrite One Domain

Rewrite example.com to example.net

recipientrewrite.mappings=(.*?)@example.com -> $1@example.net

Note

$1 matches the first group (=content of first ( … )) in the regular expression.

Rewrite to Multiple Recipients

Rewrite xxx@tocco.ch to xxx-mail1@tocco.ch and xxx-mail2@tocco.ch.

recipientrewrite.mappings=(.*?)@tocco.ch -> $1-mail1@tocco.ch, $1-mail2@tocco.ch;

Note

The name of the recipient is not preserved if multiple recipients are used.

Combine Multiple Rules

Redirect mails for example.com to example.net and redirect everything else to fallback@tocco.ch.

recipientrewrite.mappings=(.*?)@example\.com -> $1@example.net; * -> fallback@tocco.ch

Warning

Because the first matching pattern, from left to right, wins make sure the wildcard pattern (*) is at the very right.

Use a Custom Mail Server

Tip

For installations managed via Ansible, set mail_relay instead, see Configure Mail Relay. Ansible will, in turn, set this property correctly.

In case a customer wishes to use his own SMTP server the application property email.hostname can be used to set a custom mail server. (Our mail server is preconfigured.)

email.hostname=relay.cyberlink.ch

A custom port can be set too (default is 25):

email.port=225