Skip to main content
Send transactional emails through Lettr’s SMTP relay server. If your application already uses SMTP or you’re migrating from another email provider, you can switch to Lettr without changing your code — just update your SMTP credentials. Using Cursor? Jump straight in using this prompt

Why Use SMTP?

SMTP is a good choice when:
  • Legacy applications — Your application already uses SMTP and changing to an HTTP API would require significant refactoring
  • Framework built-ins — Your framework has built-in mail functions that expect SMTP credentials (WordPress, Django, Rails, etc.)
  • Third-party integrations — You’re connecting a CMS, CRM, or other tool that only supports SMTP configuration
  • Gradual migration — You’re migrating from another email provider and want to minimize code changes
If you’re building a new application or have flexibility in your stack, consider using the HTTP API or one of our SDKs instead. The API offers better error handling, request tracking, and doesn’t require maintaining a persistent connection.

Prerequisites

Before you begin, make sure you have:

SMTP Credentials

Use the following settings to connect to Lettr’s SMTP server:
SettingValue
Hostsmtp.lettr.com
Port465 (recommended), 2465, 25, 587, 2587
Usernamelettr
PasswordYour API key (starts with lttr_)
Your SMTP password is your Lettr API key. Never commit this to version control or share it publicly. Store it in environment variables or a secrets manager.

Ports & Security

The port you choose determines the security protocol for your SMTP connection:
TypePortsSecurity
SMTPS465, 2465Implicit TLS — establishes a secure connection immediately
STARTTLS25, 587, 2587Explicit TLS — starts unencrypted, then upgrades to a secure connection
We recommend using port 465 with implicit TLS for the best security and compatibility. Port 587 with STARTTLS is also widely supported.
If you’re behind a restrictive firewall, port 2465 and 2587 are alternate ports that often work when standard ports are blocked.

Quick Test with swaks

Verify your SMTP connection using swaks (Swiss Army Knife for SMTP):
swaks --to recipient@example.com \
  --from sender@yourdomain.com \
  --server smtp.lettr.com:465 \
  --auth LOGIN \
  --auth-user lettr \
  --auth-password "lttr_your_api_key_here" \
  --tlsc \
  --header "Subject: Hello from Lettr" \
  --body "This is a test email sent via SMTP."
If the connection succeeds, you’ll see output showing the SMTP conversation and a confirmation that the message was accepted.
swaks is available via package managers: brew install swaks (macOS), apt-get install swaks (Ubuntu/Debian), or download from jetmore.org/john/code/swaks.

Framework Integration Guides

Choose your framework or library for specific setup instructions:

Troubleshooting

If you see “Authentication failed” or “535 Authentication credentials invalid”:
  • Verify your API key is correct and starts with lttr_
  • Check that the username is exactly lettr (lowercase)
  • Ensure your API key hasn’t been revoked in the dashboard
If the connection times out:
  • Check your firewall isn’t blocking outbound connections on the SMTP port
  • Try alternate ports (2465 or 2587)
  • Verify smtp.lettr.com resolves correctly: nslookup smtp.lettr.com
If you see TLS or SSL handshake errors:
  • Ensure you’re using the correct encryption setting for your port (implicit TLS for 465, STARTTLS for 587)
  • Update your TLS/SSL libraries if you’re using older versions
  • Some older SMTP clients may not support modern TLS versions — consider upgrading or using the HTTP API instead

SMTP vs API

Here’s a quick comparison to help you decide:
FeatureSMTPHTTP API
Setup complexityLow — standard SMTP configMedium — requires SDK or HTTP client
Error handlingLimited — SMTP status codes onlyRich — detailed JSON error responses
Request trackingNo request ID returnedReturns request_id for tracking
AttachmentsStandard MIME encodingBase64 in JSON payload
TemplatesNot supportedFull template support
MetadataNot supportedCustom metadata supported
WebhooksNot supportedFull event tracking
PerformanceSlower — persistent connection overheadFaster — single HTTP request
Both SMTP and the HTTP API deliver emails with the same reliability and deliverability. The choice depends on your application’s needs and existing infrastructure.

What’s Next