A second mail domain and aliases

John Smith Ltd has registered a second name, johnsmith.example, and wants the mail addressed to that name to reach the same people as johnsmith.test, without creating a second set of mailboxes:

Situation

John Smith Ltd has registered a second name, johnsmith.example, and wants the mail addressed to that name to reach the same people as johnsmith.test, without creating a second set of mailboxes:

  • info@johnsmith.example must reach Jack Green and Julia Brown (accounting);
  • invoices@johnsmith.example must reach only Julia Brown, who keeps the invoices;
  • the owner, John Smith, also wants a second personal address on that name;
  • the mail leaving for that domain must appear authentic to the receiving servers (SPF, DKIM signature, DMARC), otherwise it ends up in spam.

These are four separate jobs, and it is best to do them in this order: tell the server the domain exists, publish the records in the public DNS, create the addresses, test. Atlas does the first and the third; the second you do with whoever manages the domain, because the console does not edit the public DNS.

What you need

  • Access to the DNS panel of johnsmith.example at the registrar or the domain’s provider.
  • The Mail module installed (the Mail items appear only with the module) and an administrator account (lwhite).
  • The appliance’s internet name, already reachable from the public DNS (in the example atlas.johnsmith.test, public address 198.51.100.40; see Mail, “Changing the internet name”).
  • The mail ports open to the internet (tcp 25, 465, 587, 993: see Ports and services); they are the same as for the first domain.
  • The users jgreen, jbrown and jsmith already created (Users).

Warning Adding a domain does not create mailboxes or addresses and does not touch the public DNS. Until you have done steps 3–6, the server accepts mail for @johnsmith.example, but nobody outside knows it and nobody receives it.

Steps

1. Add the domain to the server

  1. Open Mail → Domains and press the «Add domain» icon.
  2. In the «Add mail domain» form type johnsmith.example in «Domain» (lowercase, with no @ or spaces) and press «Add».
  3. Wait a few seconds: the SMTP service restarts, and for that time incoming mail waits and the senders retry. The domain appears in the list and the console goes back to the list. Open it: the detail’s title is «Mail domains / johnsmith.example».

If you see «Domain added, but the SMTP service did not restart: mail for the domain is not accepted yet. Check the mail server’s status.», open System → Status, look at the «SMTP» service in the «Services» panel and restart it from there, then try again. If instead you read «The SMTP service is not running: the change was not saved. Start it from Services and try again.», the domain was not added: start the service and repeat the step.

2. Read what is missing

  1. In the detail, the «Sender authentication» panel queries the public DNS for a few seconds. With a newly registered domain it is normal to see «Domain not found on the internet» or SPF, DKIM and DMARC panels in «Warning» or «Problem». This is your to-do list.
  2. In the MX section the panel lists the «MX servers» that receive the domain’s mail. If the domain has none, it says «The domain has no MX records: senders fall back to its A record, if any.»

3. Publish the MX record (in the public DNS)

  1. At the domain’s provider create the MX record for the root of the domain (johnsmith.example or @), priority 10, pointing to the appliance’s internet name: atlas.johnsmith.test. The value is a name, not an IP address, and that name must already have an A record pointing to 198.51.100.40.
  2. If the provider asks for the trailing dot, type atlas.johnsmith.test..

4. Generate the DKIM key and publish it

  1. In the domain’s detail, «DKIM» section, press «Generate». «Key created: publish the record shown.» appears, and below it the record, with «Name», «Type» (TXT) and «Value».
  2. Press «Copy the name» and «Copy the value» and create in the public DNS the record with that name and value. If the provider’s panel refuses the value because it is too long, in the console choose «Show split into 255-character strings» and paste it in several parts, as many panels require.
  3. Wait a few minutes and press «Check again». When «DNS record» says «Published», the «Enable» button lights up: press it. Message: «DKIM signing turned on.»

For the technician The DKIM signature is made by rspamd and requires the Antispam module: without it the console answers «The spam filter (rspamd) is not installed.». Each domain has its own selector and key: that of johnsmith.example is independent of that of johnsmith.test. The keys stay on the server even if you remove the domain.

5. Publish SPF and DMARC

  1. «SPF» section: read «Outbound» (in the example «direct, from 198.51.100.40»). In «Record to publish» is the record to create: a TXT at the root of the domain that authorises that address, of the form v=spf1 ip4:198.51.100.40 ~all. If the domain already has an SPF, the console proposes a record merged with the old one (only one is needed: two SPF records are an error, which the console reports).
  2. With an outbound relay (System → Settings → Mail server, «SMTP relay») SPF is up to the relay’s provider: the console says so («Mail leaves through smtp.provider.test: these checks are the relay provider’s concern.») and the mechanism to add (usually an include:) is given by the provider.
  3. «DMARC» section: the console proposes a first record in monitoring mode (p=none, with the report address dmarc@johnsmith.example). Create it as a TXT record named _dmarc in the public DNS. Always start from monitoring: the console proposes a stricter step only when the reports of the previous days allow it (at least 14 days; see Mail, “Raising the DMARC policy to quarantine”).

6. Optional: automatic configuration of mail programs

  1. Adding the domain makes the server answer the autoconfiguration site (autoconfig and autodiscover) for @johnsmith.example as well. For Outlook or Thunderbird to find it, the public DNS needs the names autoconfig and autodiscover of the domain pointing to the appliance. The «Sender authentication» panel does not check these names: if you do not publish them, mail programs are configured by hand (server atlas.johnsmith.test, ports 993 and 587).

7. Create the addresses

Addresses are not born with the domain: you assign them to accounts and groups. There are three tools, depending on who must receive.

One address for several people: a group with its email.

  1. Open Active Directory → Groups and press «Add group».
  2. «Name»: info; «Description»: info@ mail of the second domain; «Email»: info@johnsmith.example.
  3. In the member selector choose jgreen and then jbrown.
  4. Press «Create group». A message to info@johnsmith.example will reach the members who have an email address (see Groups and computers).

One address for a single person: an alternate email.

  1. Open Active Directory → Users and select jbrown.
  2. In the «Contacts» block, in «Alternate emails» press «Add entry» and type invoices@johnsmith.example.
  3. Press «Save». The message is «User updated.».
  4. Repeat on jsmith: «Alternate emails» john.smith@johnsmith.example.

If the address already belongs to another account, the console answers «Already used by another account»: for example you cannot give invoices@johnsmith.example to two people. For two recipients use a group.

The address for the DMARC reports.

  1. dmarc@johnsmith.example must not be created: for the server’s domains, the mail sent to that address reaches Atlas, which reads the reports. Do not assign it to a user or a group, otherwise the reports would end up there and the panel would not see them.

Tip If Jack and Julia must also write from info@johnsmith.example, add a mail identity (only with the Groupware module): in the user’s page the «Add mail identity» button opens the «New identity» window. The «Address» field must be one of the addresses the user can send with, otherwise the console answers «The user may not send with that address.» It is not verified in the console whether a group’s address can be used as a sender: try on a user first.

Check

  • In Mail → Domains, with johnsmith.example selected, press «Check again». The strip at the top shows SPF, DKIM and DMARC as «Valid» (DMARC may say «Warning» until it has received reports), the MX section lists atlas.johnsmith.test.
  • The DKIM section says «Signing» «On» and «DNS record» «Published».
  • From an external address send a message to info@johnsmith.example: jgreen and jbrown receive it. Then one to invoices@johnsmith.example: only jbrown receives it.
  • If you want the outbound test: from jbrown (with the identity invoices@johnsmith.example) write to an external address of yours and in the headers of the received message check spf=pass, dkim=pass, dmarc=pass.
  • If the message does not arrive, Mail → Logs and Mail → Filters and lists → Recent messages tell you where it stops (scenario “Mail that does not arrive”, Mail that does not arrive).

If something goes wrong

Symptom Likely cause Remedy
The panel says «Domain not found on the internet» The domain has not propagated yet, or has no records at all Publish at least the MX and retry after a few minutes with «Check again»
«The record is not visible in public DNS yet. It can take a few minutes after publishing.» Propagation in progress Wait and press «Check again» again
«The published record holds a different key: copy the value shown again.» DKIM value copied wrongly, or an old record remains Copy «Value» again and check that there are not two records with the same name
«Enable» stays grey DNS does not contain the key yet: «Publish the record first: signing turns on only once DNS carries this key.» Publish the record, wait, «Check again»
“There are 2 SPF records” Two TXT v=spf1 on the same name Merge the mechanisms into a single record and delete the other
A customer writes and the mail bounces with “domain not found” The MX is missing, or it points to a name with no A record Step 3; check that atlas.johnsmith.test resolves from the internet
info@johnsmith.example reaches only one person In the group a member has no email address Open the group and check the members’ addresses in Users
«Already used by another account» The address is already the primary or alternate address of another user, or of a group Choose another address, or remove the old one
Outbound mail ends up in spam even with valid SPF and DKIM The address’s reputation, or a missing PTR Check the «PTR» panel and the reverse DNS at the connectivity provider

Removing the domain

The domain is removed with the «Remove» icon in the detail: the confirmation reminds you that the server stops accepting its mail and that DKIM signing stops (the key is kept). The addresses that use the domain are not touched: users and groups keep them, but nothing arrives any more. Before removing the domain, also remove the alternate emails and the email of the group info, and remove the MX from the public DNS. A domain’s name cannot be changed: to rename it you remove it and add the new one.

Limits

  • The console does not publish or edit any record of the public DNS: SPF, DKIM, DMARC and MX are always an operation of yours, at the domain’s provider.
  • The message signature template (Mail → Domains, «Signature template» icon, only with Groupware) is per domain: johnsmith.example does not inherit that of johnsmith.test; with «Import from…» you copy it.
  • The certificate and the name the server presents itself with (HELO) are those of the appliance’s internet name, the same for all domains.
  • A group has a single email: for several addresses on the same list you need several groups, or several alternate emails on a user.
LET’S TALK INFRASTRUCTURE

Control starts with a conversation.

Tell us about your infrastructure. Let’s start with what you actually need.

Talk to an engineer