# SMTP

Connect an SMTP client using your existing API key.

## Connection settings

Host

smtp.usesendy.com

Port

2525

Encryption

STARTTLS

Username

apikey

Password

Your full API key

Authentication

PLAIN or LOGIN after STARTTLS

Use the literal username `apikey` and the full key, including `snd_key_`, as the password. Connect with SMTP and upgrade using STARTTLS before authentication. Implicit TLS on port 465 is not supported.

For application setup, see [Nodemailer](https://usesendy.com/docs/integrations/nodemailer), [Laravel](https://usesendy.com/docs/integrations/laravel), [Django](https://usesendy.com/docs/integrations/django), [Rails](https://usesendy.com/docs/integrations/rails), [PHPMailer](https://usesendy.com/docs/integrations/phpmailer), or [WordPress](https://usesendy.com/docs/integrations/wordpress).

Want to keep using `sendmail` on your VPS? Configure [Exim4](https://usesendy.com/docs/smtp/exim4) or [Postfix](https://usesendy.com/docs/smtp/postfix) to relay outbound email through Sendy. Your applications and scripts can keep their local mail submission setup, with Sendy’s SMTP credentials managed by the mail server. Sender verification still applies.

## Send with curl

Save the following as `email.eml`. Preserve the blank line between headers and body:

email.eml

```
From: My App <noreply@example.com>
To: recipient@example.com
Subject: Welcome
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<h1>Welcome</h1><p>Your account is ready.</p>
```

SMTP submission · curl

```
curl --url 'smtp://smtp.usesendy.com:2525' --ssl-reqd \
  --user 'apikey:API_KEY' \
  --mail-from 'noreply@example.com' \
  --mail-rcpt 'recipient@example.com' \
  --upload-file email.eml
```

Replace `API_KEY`, the sender, and the recipient in both the file and command. Your account password is not used.

## Message requirements

*   Use verified domains on your account for the MIME `From` header and any nonempty SMTP `MAIL FROM`. Delivery-failure notifications can use `MAIL FROM:<>`; the MIME `From` domain must still be verified. Display names belong in the MIME header.
*   The optional `MAIL FROM` parameter `AUTH=` accepts an xtext-encoded submitter address or `<>` for an unknown submitter. Your API key determines account access and sending permissions; `AUTH=` does not change them.
*   Recipients come from the SMTP envelope. `To` and `Cc` headers alone do not add recipients.
*   MIME preserves HTML, plain-text alternatives, attachments, and reply-to headers. Use your mail library to encode non-ASCII headers. Email addresses must be ASCII.
*   Provide one `From` header and a nonblank subject of up to 255 bytes. `Sender` and `Resent-*` headers are unsupported.

Recipients per message

Up to 50 distinct recipients.

Message size

1 MiB by default, including encoded attachments.

Line length

Up to 1,000 bytes, including its line ending.

Configured size limit

Advertised in the SMTP `SIZE` capability.

## Retry safely with an idempotency key

Add one optional email header and reuse its value when retrying the same email:

Email header

```
Sendy-Idempotency-Key: welcome/user-123
```

Keys contain 1 to 128 printable ASCII bytes without spaces. They are case-sensitive and scoped to your account across its API keys, separately from HTTP idempotency keys. Matching retries return `250` with the original job IDs, without creating jobs or reserving credit again. Keys remain reserved while the original job records are retained; there is no time-based expiry. Without this header, each submission creates new jobs.

Keep the envelope sender, recipient set, and cleaned MIME message unchanged. Recipient order and generated `Date`, `Message-ID`, and `Received` headers do not affect matching. Other headers and MIME body bytes do, including multipart boundaries and attachment encoding. Preserve the composed raw message for multipart retries.

Reusing a key for a different email returns `554 5.5.0`. Use a new key for new content or recipients. Empty, repeated, or malformed key headers return `554`. Sendy removes the key header before delivery.

## Queued response

SMTP response

```
250 2.0.0 Queued jobs 123,124
```

Sendy creates one job per recipient. This response confirms storage, not inbox delivery. Look up each returned ID with [Get email status](https://usesendy.com/docs/api/email-status) or open [Emails](https://usesendy.com/emails).

Without an idempotency key, resubmitting after a lost response can create duplicate jobs. See [Errors](https://usesendy.com/docs/errors) for retry guidance.
