Skip to main content
WisMail

Send mail through a smarthost / SMTP relay

By default WisMail delivers outgoing mail directly to the receiving server found in DNS (the MX record), from your own IP address on port 25. That is the best setup, but it fails when your provider blocks outbound port 25 (many cloud and home networks do) or when your IP address has a poor reputation. In that case you send through a smarthost, also called an SMTP relay: an external SMTP server that accepts your mail with a user name and password and delivers it for you. Allow about 15 minutes. Background on delivery: SMTP, IMAP and POP3 server.

When you need a relay

  • Outbound connections to port 25 are blocked by your hosting provider, so mail stays in the queue. Test from the server: nc -vz gmail-smtp-in.l.google.com 25. If it hangs, port 25 is blocked (the install guide shows the same test).
  • The provider will not unblock port 25 and gives you no clean sending IP.
  • Your IP address is on a blacklist and you want to send through a provider with a better reputation while you clean it up.

You need from the relay provider: the server name, the port (usually 587, sometimes 25 or 2525), and a user name and password.

Step 1. Open the SMTP delivery settings

Log in to web administration and open Configuration, SMTP Server, then the SMTP Delivery tab. At the bottom of the SMTP delivery list you see the existing relay rules and a last, fixed line Deliver directly using DNS MX records: this is what the server does when no rule applies.

Web administration SMTP Server, SMTP Delivery tab: relay server rule with host name, port and authentication

Step 2. Add a relay rule

  1. Choose Add to open Add SMTP relay server rule.
  2. Description: a label such as "Provider relay".
  3. Condition: choose Always use this relay server to send everything through the relay. See "Global or per domain" below for the other choice.
  4. Relay server hostname and Relay server port: the values from your provider. The Default button fills port 25.
  5. Tick Relay server requires authentication, then enter the User and Password. For Authentication choose SMTP AUTH Command, which is what nearly every provider uses. (POP3 before SMTP is an older method for providers that ask for it.)
  6. Keep Enable rule ticked and click OK, then Apply.

Global or per domain

The Condition decides when a rule is used. Instead of always, choose Use this server if the sender email address or the recipient email address is (or is not) a pattern, for example *@example.com. This lets you:

  • send one domain through a relay and the others directly,
  • send mail to one destination (for example *@gmail.com) through a relay and the rest directly.

Rules are tried from top to bottom; use the Up and Down buttons to order them. Mail that matches no rule goes direct through MX.

TLS to the relay

Under SMTP client options on the same tab, Use SSL/TLS if supported by the remote server is available: leave it on so credentials and mail are encrypted when the relay offers it. The setting Port for remote SMTP server connections applies to direct delivery.

SPF with a relay

Receivers check that the server that delivered your mail is allowed by your SPF record. When a relay delivers your mail, add the relay provider's SPF include: to your record, before -all:

example.com.   TXT   "v=spf1 mx include:spf.relay-provider.example -all"

The provider documents the exact include: value. Keep DKIM signing on for the domain and check a delivered message with "Show original": you want SPF: PASS and DKIM: PASS. Details: SPF, DKIM and DMARC.

Test and read the queue

  1. Send a message from webmail to an outside address.
  2. Open Status, Message Queue: a message waiting there has not been delivered yet. Select it to see its state; you can retry it now or remove it. The server retries failed deliveries and sends a bounce report to the sender if the message cannot be delivered within the configured time.
  3. Open Logs and read the Mail log, and the Error log if something fails, for lines about the relay connection.

Troubleshooting

Mail stays in the queue. Check the log. An authentication error means a wrong user name, password or Authentication type. A connection timeout means the relay port is blocked: try another port (587 or 2525) with the provider.

The relay accepts mail but receivers mark it as spam. Fix SPF as above, confirm the PTR record in DNS setup, and check the relay provider's own rules.

Only some mail should use the relay. Use a Use this server if condition instead of Always.

Next steps