# SMTP relay

Send email from any app, framework or plugin that speaks SMTP. Point it at `smtp.sendio.run`, sign in with a send.io mailbox, and every message shows up in Emails with the same events and webhooks as an API send.

## Settings

| Setting | Value |
| --- | --- |
| Host | `smtp.sendio.run` |
| Port | `587` |
| Encryption | STARTTLS (required before you sign in). Some apps call this TLS. Port 465 with implicit SSL is not offered. |
| Authentication | PLAIN or LOGIN |
| Username | The mailbox address, such as `hello@yourdomain.com` |
| Password | The mailbox password, or a full-access API key of the team that owns the mailbox |
| From address | The mailbox address you sign in with, or another address on the same domain |
| Message size | Up to 50 MB, attachments included (about 37 MB of files once they are base64-encoded) |
| Recipients | Up to 3 per message (To, Cc and Bcc together) |

Copy into your app:

```
Host:      smtp.sendio.run
Port:      587
Security:  STARTTLS
Username:  hello@yourdomain.com
Password:  your mailbox password or API key
```

## Get a username and password

SMTP signs in as a mailbox, so the username is always a full address on one of your verified domains.

> **Note:** SMTP may need to be requested first. If your workspace shows **SMTP is off** in [Settings, SMTP](https://app.sendio.run/settings/smtp), send a request there; a send.io admin reviews it and the workspace admins get an email with the decision. Until then SMTP answers `550 5.7.1 SMTP is not enabled for this workspace`. The API, IMAP and the Unibox work without it.

1. **Verify your domain.** Add it in [Domains](https://app.sendio.run/domains) and publish the DNS records send.io shows you.
2. **Create a mailbox.** Open [Mailboxes](https://app.sendio.run/mailboxes) and create one, such as `hello@yourdomain.com`, or call [POST /mailboxes](https://developer.send.io/docs/api#create-mailbox). The password is shown once.
3. **Use it in your app.** The address is the username and the mailbox password is the password. Lost it? Choose New password on the mailbox, or call [POST /mailboxes/{id}/password](https://developer.send.io/docs/api#reset-mailbox-password); the old one stops working at once.

A full-access [API key](https://app.sendio.run/integrations/api-keys) also works as the password for any mailbox of its team, and an inbox-scoped key works for its own inbox's address. Prefer the mailbox password in apps: it can only send from that mailbox's domain. Revoking a key stops SMTP logins with it immediately.

## Examples

Each example reads the password from `SENDIO_SMTP_PASSWORD`. Replace `hello@yourdomain.com` with your mailbox.

Nodemailer:

```javascript
import nodemailer from "nodemailer";

const transporter = nodemailer.createTransport({
  host: "smtp.sendio.run",
  port: 587,
  secure: false, // STARTTLS on 587
  requireTLS: true,
  auth: { user: "hello@yourdomain.com", pass: process.env.SENDIO_SMTP_PASSWORD },
});

await transporter.sendMail({
  from: "Acme <hello@yourdomain.com>",
  to: "you@example.com",
  subject: "Hello from send.io",
  text: "It works.",
  html: "<p>It works.</p>",
});
```

Python:

```python
import os
import smtplib
from email.message import EmailMessage

msg = EmailMessage()
msg["From"] = "Acme <hello@yourdomain.com>"
msg["To"] = "you@example.com"
msg["Subject"] = "Hello from send.io"
msg.set_content("It works.")
msg.add_alternative("<p>It works.</p>", subtype="html")

with smtplib.SMTP("smtp.sendio.run", 587) as smtp:
    smtp.starttls()
    smtp.login("hello@yourdomain.com", os.environ["SENDIO_SMTP_PASSWORD"])
    smtp.send_message(msg)
```

PHPMailer:

```php
<?php
use PHPMailer\PHPMailer\PHPMailer;

$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = 'smtp.sendio.run';
$mail->Port = 587;
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->SMTPAuth = true;
$mail->Username = 'hello@yourdomain.com';
$mail->Password = getenv('SENDIO_SMTP_PASSWORD');

$mail->setFrom('hello@yourdomain.com', 'Acme');
$mail->addAddress('you@example.com');
$mail->isHTML(true);
$mail->Subject = 'Hello from send.io';
$mail->Body = '<p>It works.</p>';
$mail->AltBody = 'It works.';
$mail->send();
```

Laravel:

```bash
MAIL_MAILER=smtp
MAIL_HOST=smtp.sendio.run
MAIL_PORT=587
MAIL_USERNAME=hello@yourdomain.com
MAIL_PASSWORD=your_mailbox_password
# Laravel 11 and newer: STARTTLS is used automatically on 587
MAIL_SCHEME=smtp
# Laravel 10 and older use this line instead of MAIL_SCHEME
# MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=hello@yourdomain.com
MAIL_FROM_NAME="${APP_NAME}"
```

Django:

```python
# settings.py
import os

EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = "smtp.sendio.run"
EMAIL_PORT = 587
EMAIL_USE_TLS = True  # STARTTLS
EMAIL_HOST_USER = "hello@yourdomain.com"
EMAIL_HOST_PASSWORD = os.environ["SENDIO_SMTP_PASSWORD"]
DEFAULT_FROM_EMAIL = "Acme <hello@yourdomain.com>"
```

Rails:

```ruby
# config/environments/production.rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  address: "smtp.sendio.run",
  port: 587,
  user_name: "hello@yourdomain.com",
  password: ENV["SENDIO_SMTP_PASSWORD"],
  authentication: :plain,
  enable_starttls: true, # Rails 6 and older: enable_starttls_auto: true
}
```

## WordPress

Install the WP Mail SMTP plugin, choose **Other SMTP** as the mailer and enter:

| WP Mail SMTP field | Value |
| --- | --- |
| From Email | `hello@yourdomain.com` with Force From Email on |
| Mailer | Other SMTP |
| SMTP Host | `smtp.sendio.run` |
| Encryption | TLS |
| SMTP Port | `587` |
| Auto TLS | On |
| Authentication | On |
| SMTP Username | `hello@yourdomain.com` |
| SMTP Password | Your mailbox password |

Or set the same values in `wp-config.php`, which keeps the password out of the database:

wp-config.php:

```php
// wp-config.php: keeps the password out of the database (WP Mail SMTP reads these)
define( 'WPMS_ON', true );
define( 'WPMS_MAILER', 'smtp' );
define( 'WPMS_SMTP_HOST', 'smtp.sendio.run' );
define( 'WPMS_SMTP_PORT', 587 );
define( 'WPMS_SSL', 'tls' );
define( 'WPMS_SMTP_AUTH', true );
define( 'WPMS_SMTP_AUTOTLS', true );
define( 'WPMS_SMTP_USER', 'hello@yourdomain.com' );
define( 'WPMS_SMTP_PASS', 'your_mailbox_password' );
define( 'WPMS_MAIL_FROM', 'hello@yourdomain.com' );
define( 'WPMS_MAIL_FROM_FORCE', true );
```

Then use the plugin's Email Test tab to send yourself a message.

## Command line

Handy for checking credentials from a server before you configure an app.

swaks:

```bash
swaks --server smtp.sendio.run:587 --tls \
  --auth LOGIN --auth-user hello@yourdomain.com --auth-password "$SENDIO_SMTP_PASSWORD" \
  --from hello@yourdomain.com --to you@example.com \
  --header "Subject: Hello from send.io" --body "It works."
```

curl:

```bash
cat > message.txt <<'EOF'
From: Acme <hello@yourdomain.com>
To: you@example.com
Subject: Hello from send.io

It works.
EOF

curl --url smtp://smtp.sendio.run:587 --ssl-reqd \
  --user "hello@yourdomain.com:$SENDIO_SMTP_PASSWORD" \
  --mail-from hello@yourdomain.com --mail-rcpt you@example.com \
  --upload-file message.txt
```

## What happens after you send

- send.io answers `250` only after the message is stored, so a message your app saw accepted is not lost. If storing fails you get `451` and your app retries.
- The message appears in [Emails](https://app.sendio.run/emails) and in `GET /emails` like an API send, with its delivery events: `email.sent`, `email.delivered`, `email.bounced`, `email.complained` and the rest.
- Your [webhooks](https://developer.send.io/docs/api#create-webhook) get the same events as for API sends.
- The message is sent as your app wrote it. Headers you add (`Reply-To`, `List-Unsubscribe`, your own `X-` headers) are kept, and send.io signs it with your domain's DKIM key.

## What SMTP does not do

SMTP carries a finished message, so features that need extra fields are API only. Use the [API](https://developer.send.io/docs/api#send-email) or an [SDK](https://developer.send.io/docs/sdks) for these:

- **Scheduling**, **templates**, **tags** and **metadata**. There are no SMTP headers for them.
- **Idempotency keys.** Your SMTP client's own retry handling applies instead.
- **Sending as another address.** The envelope sender must be the mailbox you signed in with. To send from several addresses, create a mailbox for each.
- **Port 465, 25 or 2587.** Only 587 with STARTTLS is open.

[Test addresses](https://developer.send.io/docs/test-addresses) such as `delivered@send.io` do work over SMTP. The relay does not deliver to them: it records the message and the simulated outcome, the same as an API send.

## Troubleshooting

| What you see | What to check |
| --- | --- |
| `535 5.7.8 Error: authentication failed` | The username must be the full mailbox address (not `sendio`, `resend` or `apikey`). The password must be that mailbox's current password or a full-access key of its team. A reset password or revoked key stops working at once. If the mailbox shows IMAP/SMTP as pending, reset its password. |
| `530 5.7.0 Authentication required` | Your app sent mail without signing in. send.io offers AUTH only after STARTTLS, so turn on STARTTLS (TLS) and authentication. |
| `553 5.7.1 Sender address rejected` | The From (envelope sender) is not the mailbox you signed in with. Send from that address, or sign in as the mailbox you want to send from. |
| `552` or message too large | The message is over 50 MB. Link large files instead of attaching them. |
| TLS or handshake errors | Use STARTTLS on 587, not SSL/TLS on 465. In Nodemailer that is `secure: false` (STARTTLS still runs), in PHPMailer `ENCRYPTION_STARTTLS`. TLS 1.2 or newer is required. |
| Connection times out | Your host may block outbound SMTP. Many clouds block port 25, and some also block 465 and 587 on new accounts (DigitalOcean, for example). send.io only needs 587: check with `nc -vz smtp.sendio.run 587`. If it is blocked, ask your provider to open it, or send with the [HTTP API](https://developer.send.io/docs/api#send-email), which uses port 443. |
| `451 4.3.0` temporary error | send.io could not store the message for a moment. SMTP clients retry on their own; nothing was sent. |
| `550 5.7.1 SMTP is not enabled for this workspace` | SMTP has not been approved for your workspace yet, or the approval ended. Request it in [Settings, SMTP](https://app.sendio.run/settings/smtp). An approval can also limit the From domains and the SMTP emails per day; a daily limit answers `451 4.7.1` until midnight UTC. |

To see the conversation yourself, open a session with OpenSSL and type `EHLO test`. You should see `AUTH PLAIN LOGIN` after the TLS handshake:

```bash
openssl s_client -starttls smtp -connect smtp.sendio.run:587 -crlf -quiet
```

## Coming from Resend SMTP

| Setting | Resend | send.io |
| --- | --- | --- |
| Host | `smtp.resend.com` | `smtp.sendio.run` |
| Port | 465, 587 and others | `587` (STARTTLS) |
| Username | `resend` | Your mailbox address |
| Password | API key | Mailbox password or full-access API key |

Change those three values and keep the rest of your configuration.
