Skip to main content
Routes in Lettermint allow you to control which email provider (SMTP, API, etc.) is used to send your emails. You can configure different routes for different types of emails, such as transactional vs. marketing emails.

Configuring a route

Add the route_id option to your mailer configuration in config/mail.php:
'mailers' => [
    'lettermint' => [
        'transport' => 'lettermint',
        'route_id' => env('LETTERMINT_ROUTE_ID'),
    ],
],
Then set the route ID in your .env file:
LETTERMINT_ROUTE_ID=your-route-id
Find your route IDs in the Lettermint dashboard under Routes. Each route represents a specific email delivery configuration.

Multiple mailers with different routes

You can configure multiple mailers using the same Lettermint transport but with different routes. This is useful for separating transactional emails from marketing emails:
// config/mail.php
'mailers' => [
    'lettermint_marketing' => [
        'transport' => 'lettermint',
        'route_id' => env('LETTERMINT_MARKETING_ROUTE_ID'),
    ],
    'lettermint_transactional' => [
        'transport' => 'lettermint',
        'route_id' => env('LETTERMINT_TRANSACTIONAL_ROUTE_ID'),
    ],
],
Then in your .env file:
LETTERMINT_MARKETING_ROUTE_ID=route-marketing-123
LETTERMINT_TRANSACTIONAL_ROUTE_ID=route-transactional-456

Using different mailers

Send emails through specific routes using the mailer() method:
use Illuminate\Support\Facades\Mail;
use App\Mail\MarketingEmail;
use App\Mail\TransactionalEmail;

// Send through marketing route
Mail::mailer('lettermint_marketing')
    ->to($user)
    ->send(new MarketingEmail());

// Send through transactional route
Mail::mailer('lettermint_transactional')
    ->to($user)
    ->send(new TransactionalEmail());

Route selection strategy

1

Check mailer configuration

The driver first checks if a route_id is configured for the specific mailer being used.
2

Use configured route

If a route ID is configured, the email is sent through that route.
3

Use default route

If no route ID is configured, Lettermint uses your account’s default route.

Example: Separate routes for different email types

Here’s a complete example showing how to organize your email routing:
// config/mail.php
return [
    'default' => env('MAIL_MAILER', 'lettermint_transactional'),
    
    'mailers' => [
        'lettermint_transactional' => [
            'transport' => 'lettermint',
            'route_id' => env('LETTERMINT_TRANSACTIONAL_ROUTE_ID'),
        ],
        'lettermint_marketing' => [
            'transport' => 'lettermint',
            'route_id' => env('LETTERMINT_MARKETING_ROUTE_ID'),
        ],
        'lettermint_notifications' => [
            'transport' => 'lettermint',
            'route_id' => env('LETTERMINT_NOTIFICATIONS_ROUTE_ID'),
        ],
    ],
];

Default mailer behavior

If you don’t specify a mailer, Laravel uses the default mailer from your config/mail.php:
// Uses default mailer from config/mail.php
Mail::to($user)->send(new WelcomeEmail());

// Explicitly uses a specific mailer
Mail::mailer('lettermint_marketing')->to($user)->send(new WelcomeEmail());
Make sure each route ID exists in your Lettermint dashboard before using it in your configuration. Invalid route IDs will cause email delivery to fail.

Testing route configuration

You can verify your route configuration using the transport’s config:
use Illuminate\Mail\MailManager;
use ReflectionClass;

$manager = app(MailManager::class);
$transport = $manager->createSymfonyTransport([
    'transport' => 'lettermint',
    'route_id' => 'test-route-123',
]);

// Access the config to verify route_id
$reflection = new ReflectionClass($transport);
$configProperty = $reflection->getProperty('config');
$configProperty->setAccessible(true);
$config = $configProperty->getValue($transport);

echo $config['route_id']; // Outputs: test-route-123

Build docs developers (and LLMs) love