All help articles

Sending through us from your own mail server

Your own mail servers (Exim, Postfix, Microsoft Exchange, Sendmail) and devices that send mail (a web server, a scanner, a NAS) can send their outgoing mail through us, as a smarthost. Their mail then leaves from our servers: signed with your domain's DKIM key, checked for viruses and spam like the mail your users send, and within your plan's sending limits. Receivers see SPF, DKIM and DMARC pass for your domain, as they do for mail sent from webmail.

This needs a plan that includes Smarthost relay. Only the tenant's owners and admins set it up.

Making a relay credential

In the tenant manager, under Mail โ†’ Sending from your own mail servers (smarthost), choose New relay credential:

Make credential shows the secret, the password your server signs in with, once, with settings for Exim and Postfix. Copy it then. New secret replaces it later, and the old one stops working at once.

What the server may send

A domain that moves to another tenant, or stops being proved, stops being relayed at once. Everything else that applies to mail your users send applies here too: risky attachments, virus scanning, your sending limits, outgoing spam checks, suspensions and the message trace. A trace shows the credential's name.

Server settings

Every server needs the same four things:

SettingValue
Server (smarthost)your mail server's host name, shown on the credential
Port587 with STARTTLS, or 465 with TLS from the start
User namethe mailbox's address, such as relay@example.com
Passwordthe credential's secret (cs_sh_...)

Always use TLS. Port 25 does not take relayed mail.

Exim (Debian and Ubuntu)

Run dpkg-reconfigure exim4-config and choose "mail sent by smarthost; received via SMTP or fetchmail". Give the smarthost as HOST::587 (two colons before the port), or set it in /etc/exim4/update-exim4.conf.conf:

dc_eximconfig_configtype='smarthost'
dc_smarthost='HOST::587'

Put the user name and secret in /etc/exim4/passwd.client:

HOST:relay@example.com:cs_sh_...

Then run update-exim4.conf and systemctl restart exim4. To keep the secret readable only by Exim: chown root:Debian-exim /etc/exim4/passwd.client and chmod 640 /etc/exim4/passwd.client.

Exim (any system, its own configuration)

In the routers section, before the dnslookup router:

smarthost:
  driver = manualroute
  domains = ! +local_domains
  transport = smarthost_smtp
  route_list = * HOST::587 byname
  no_more

In the transports section:

smarthost_smtp:
  driver = smtp
  port = 587
  hosts_require_auth = *
  hosts_require_tls = *

In the authenticators section:

plain_login:
  driver = plaintext
  public_name = PLAIN
  client_send = ^relay@example.com^cs_sh_...

Set qualify_domain (and the bounce sender) to one of the credential's domains, so mail from local users without a domain gets one we relay.

Postfix

In /etc/postfix/main.cf:

relayhost = [HOST]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt

In /etc/postfix/sasl_passwd:

[HOST]:587 relay@example.com:cs_sh_...

Then chmod 600 /etc/postfix/sasl_passwd, postmap /etc/postfix/sasl_passwd and systemctl reload postfix. Set myorigin to one of the credential's domains.

Microsoft Exchange

Make a send connector (Exchange admin center โ†’ Mail flow โ†’ Send connectors) for the address space *, routing through a smart host: your mail server's host name. Choose Basic authentication over TLS with the user name and secret, and port 587 (Set-SendConnector -Port 587).

Sendmail

In sendmail.mc, define(SMART_HOST', [HOST]')dnl and define(RELAY_MAILER_ARGS', TCP $h 587')dnl, with AuthInfo:HOST "U:relay@example.com" "P:cs_sh_..." "M:PLAIN" in /etc/mail/authinfo. Rebuild the configuration and restart Sendmail.

Devices and applications

A scanner, a NAS, a web application or a script takes the same server, port, user name and password in its "SMTP server" settings. Choose STARTTLS (587) or SSL/TLS (465). For a device that cannot send as many addresses, an app password of its own mailbox is simpler.

When something is refused

Every message, refused or not, is in the message trace.

From the API and command line

The tenant's owners and admins use GET and POST /v1/tenants/{tenantId}/smarthosts, PATCH and DELETE /v1/tenants/{tenantId}/smarthosts/{smarthostId}, and POST .../{smarthostId}/secret for a new secret. A key limited to some of the tenant's domains cannot use them.