Skip to main content
Configure Laravel to send emails through Lettr using SMTP. This approach works with Laravel’s built-in mail system — no package installation required, just update your environment variables.
If you prefer a tighter integration with template support and code generation, check out the Laravel SDK instead. The SDK integrates directly with Laravel’s mail transport while adding type-safe template features.

Prerequisites

Before you begin, make sure you have:

API Key

Create an API key in the Lettr dashboard

Verified Domain

Add and verify your sending domain
You’ll also need:
  • Laravel 10.x, 11.x, or 12.x installed
  • A MAIL_FROM_ADDRESS that uses your verified sending domain

Configuration

1

Update your .env file

Add the following SMTP settings to your .env file:
Replace lttr_your_api_key_here with your actual Lettr API key. Your API key is your SMTP password.
2

Verify config/mail.php

Ensure your config/mail.php has the SMTP mailer configured. Laravel ships with this by default:
No changes needed — the environment variables from .env will be automatically loaded.
3

Clear configuration cache

After updating your .env file, clear Laravel’s configuration cache:
This ensures Laravel picks up your new SMTP settings.

Sending Emails

Once configured, send emails using Laravel’s Mail facade exactly as you normally would:

Using Mailables

Using Mail::raw()

For simple text emails without a Mailable class:

Using Mail::html()

For HTML emails without a Mailable class:

Testing Your Setup

Quick Test with Tinker

Send a test email using Tinker to verify your SMTP configuration:
If the command succeeds without errors, check your inbox. The email should arrive within a few seconds.

Test with a Real Mailable

Create a test Mailable:
Update app/Mail/TestEmail.php:
Create the view at resources/views/emails/test.blade.php:
Send the test email:

Port Options

Lettr supports multiple SMTP ports. If port 587 doesn’t work for your environment, try these alternatives:
Port 465 uses implicit SSL/TLS, which establishes a secure connection immediately. Port 587 uses explicit STARTTLS, which upgrades an unencrypted connection. Both are secure.

Multiple Mailers

If you need to use both Lettr and another email provider (e.g., for different email types), configure multiple mailers:
Send using a specific mailer:

Error Handling

Wrap your mail sending in try-catch blocks to handle SMTP errors:

Troubleshooting

Check your API key is correct and starts with lttr_. Verify the username is exactly lettr (lowercase). Run php artisan config:clear to clear cached configuration.
Your firewall may be blocking outbound SMTP connections. Try alternate ports (465, 2465, or 2587). Verify smtp.lettr.com resolves correctly.
Ensure your MAIL_FROM_ADDRESS domain is verified in the Lettr dashboard. See Domain Verification for help.
Check your Lettr logs to see if the API accepted the request. If accepted but not delivered, see Delivery Issues.
Enable Laravel’s mail debug logging in .env:
This logs all outgoing emails to storage/logs/laravel.log.For testing without sending real emails, use the log mailer:

What’s Next

Laravel SDK

Upgrade to the Laravel SDK for template support

Sending Best Practices

Improve deliverability and engagement

Templates

Create reusable email templates

Troubleshooting

Fix common delivery issues