Skip to main content
mailers.io

Providers

Connecting any SMTP server: host, port and TLS

By mailers.io team Published 5 min read

Besides the providers that have their own connection, mailers.io can send through any server that speaks SMTP: your own mail server, a hosting company’s mail service, or a provider that has no dedicated connection here. This is the most flexible way to connect, and also the one where you do the most checking yourself. This guide covers the fields, the rules that can surprise you, and what to test.

When to use SMTP, and when not to

Use it for a server that has no API connection in mailers.io, or for a mailbox you want to send from. The summary is on the SMTP integration page.

Do not use it for a provider that has a dedicated connection. For Amazon SES, SendGrid, Mailgun, Postmark, SparkPost, Brevo, Elastic Email and ZeptoMail, connect through the API instead. The API connection gives mailers.io things that plain SMTP cannot: domain registration, signed events and better error classes. A hosted provider’s SMTP host also gets the pacing meant for mailboxes, which is slower than the provider could take.

Before you start

You need:

  • the host name of the server and the port it listens on;
  • a username and password, if the server asks for a login;
  • a domain you can edit DNS for, ideally a subdomain used for sending (see the subdomain strategy);
  • room for the domain in your plan. Check pricing.

Step 1: choose the port and the security

The fields are host, port, security, username and password. The rules are strict, on purpose.

Ports. Only 25, 465, 587 and 2525 are accepted. If you are unsure which to use, SMTP ports 587, 465 and 2525 explains the difference. In short:

  • 587 with STARTTLS is the usual choice for submitting mail from an application or a mailbox.
  • 465 uses TLS from the first byte.
  • 2525 is an alternative that hosts offer when 587 is blocked.
  • 25 is for server-to-server delivery. Many networks block it, and many providers do not accept logins on it.

Security. Choose STARTTLS or TLS. With STARTTLS, mailers.io connects, checks that the server offers STARTTLS and upgrades; if it does not, the attempt fails rather than falling back to plain text. The certificate is verified, so a self-signed or mismatched certificate fails with a TLS error. In production, sending without TLS is refused outright.

Login. Username and password go together: you cannot give one without the other. mailers.io logs in with AUTH PLAIN or AUTH LOGIN, and it does so only after the connection is encrypted.

Step 2: the reachability rule

The host must be reachable from the public internet. mailers.io checks every address the name resolves to before it connects, and it refuses private, loopback, link-local and CGNAT ranges. This protects you and every other customer: a server that could be pointed at internal addresses could be used to probe a network.

The effect is practical. A mail server that lives on your office network or inside a private cloud cannot be connected until it has a public address. If the connection form says the host is not allowed, this is why.

Step 3: connect and test

Open Sending, then Servers, and add a server. Choose SMTP, fill in the fields and run Test connection. The test opens the connection, applies STARTTLS if you chose it, and logs in. It sends no mail. The errors are specific, and each points at one thing:

  • a connection failure or timeout points at the host, the port or a firewall;
  • a TLS failure points at the certificate or at a port that expects the other mode, such as STARTTLS on 465;
  • an authentication failure points at the username or password, or at a server that offers no login method mailers.io supports.

The password is sealed before it is stored and is write-only: you can replace it by editing the server, but never read it back.

Step 4: DKIM, signed by mailers.io

An API provider signs the mail with its own keys. A plain SMTP server does not know your domain, so mailers.io signs the message itself. When you add the domain under Sending domains and choose the SMTP server, mailers.io makes an RSA-2048 key for the domain and shows you a DNS record. Publish it at your DNS host and use the verify button. DNS takes time to spread.

You still need SPF and DMARC, and those are not created for you. SPF must authorise the sending server of the SMTP host, which is the host’s job to tell you; DMARC is a policy you write for your domain. SPF, DKIM and DMARC explained covers all three.

Step 5: bounces and replies

An API provider calls back with events. A plain SMTP server does not, so mailers.io has two sources:

  • At the moment of sending. The server may refuse a recipient or the message immediately. mailers.io reads those replies, and a permanent refusal counts as a hard failure.
  • Later, through an IMAP bounce mailbox. Many bounces arrive minutes after the send, as a report in the mailbox of the From or return address. Add an optional IMAP bounce mailbox to the server and mailers.io reads those reports, using header fields only. This is the one place where mailers.io connects to your server a second time.

A hard bounce puts the address on your suppression list, and it is not mailed again. Suppressed recipients are never charged a credit. Without the IMAP mailbox you will only catch the immediate refusals, so add it if you send at any volume.

Opens and clicks come from mailers.io tracking in every case.

Step 6: speed limits matter more here

A mailbox or a shared hosting server has tight limits, often a few hundred messages a day, and some servers lock the account when it is exceeded. Look up the limit and put a speed limit and a daily cap on the server below it. Daily limits per mailbox and server shows how the two caps work together.

If you have more than one server, routing sends to the next one when a server is full. Every plan has failover and rotation across your own servers, by default round robin with 3 attempts.

What mailers.io does not do for SMTP

It does not reach servers on private networks. It does not send without TLS in production. It does not set up SPF or DMARC for you. It does not give you inbox placement, since that depends on the server, its address and your domain. And it does not run the mail server: if the host is down, mailers.io will fail over to another server if you have one.

Questions and answers

Which ports and security modes can I use?

Ports 25, 465, 587 and 2525, with STARTTLS or TLS. Sending without TLS is refused in production.

Can I connect a server on a private network?

No. The host must be publicly reachable. Private, loopback, link-local and CGNAT addresses are refused.

Who signs DKIM?

mailers.io signs it with a key for your domain. You publish the DNS record it shows.

How do bounces come back?

Failures at the moment of sending are read from the SMTP replies. Later bounces come from an optional IMAP bounce mailbox.

Written by the mailers.io team. Published .

Keep reading

Related posts

Send cold e-mail from your own servers.

Connect your servers, import a list and write the steps. Replies stop the sequence.

  • 7-day money-back guarantee
  • Bring your own providers
  • Cancel anytime