Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.lettr.com/llms.txt

Use this file to discover all available pages before exploring further.

Manage your sending domains through the Lettr facade. This is useful for multi-tenant apps that onboard customer domains, or for automating DNS verification checks from an Artisan command or job. For the concepts behind domain setup (SPF, DKIM, DMARC, tracking domains), see Sending Domains.
use Lettr\Laravel\Facades\Lettr;

List Domains

$domains = Lettr::domains()->list();

foreach ($domains as $domain) {
    echo $domain->domain;              // example.com
    echo $domain->status->value;       // 'pending', 'approved'
    echo $domain->canSend;             // true/false
    echo $domain->dkimStatus?->value;  // 'valid', 'invalid', etc.
    echo $domain->cnameStatus?->value;
}

API Reference

GET /domains

Add a Domain

use Lettr\ValueObjects\DomainName;

$result = Lettr::domains()->create('example.com');
// or pass a DomainName value object
$result = Lettr::domains()->create(new DomainName('example.com'));

echo $result->domain;        // example.com
echo $result->status->value; // 'pending'
echo $result->statusLabel;   // "Pending Review"

// DKIM records to publish in DNS
if ($result->dkim !== null) {
    echo $result->dkim->selector;      // e.g. "scph0226"
    echo $result->dkim->publicKey;
    echo $result->dkim->headers;       // signed headers
    echo $result->dkim->signingDomain;
}

API Reference

POST /domains

Get Domain Details

$domain = Lettr::domains()->get('example.com');

echo $domain->domain;
echo $domain->status->value;
echo $domain->canSend;
echo $domain->dkimStatus?->label();   // DnsStatus enum
echo $domain->cnameStatus?->label();
echo $domain->dmarcStatus?->label();
echo $domain->spfStatus?->label();
echo $domain->trackingDomain;
echo $domain->createdAt;

// DKIM record helpers
if ($domain->dkim !== null) {
    echo $domain->dkim->recordName('example.com'); // Full DNS record name
    echo $domain->dkim->recordValue();             // Full DNS record value
}

API Reference

GET /domains/

Verify Domain DNS

After publishing the DNS records, trigger a verification check:
$verification = Lettr::domains()->verify('example.com');

if ($verification->isFullyVerified()) {
    echo "Domain is ready to send!";
} else {
    // Individual record statuses
    echo $verification->dkimStatus->label();   // "Valid", "Invalid", "Missing", etc.
    echo $verification->cnameStatus->label();
    echo $verification->dmarcStatus->label();
    echo $verification->spfStatus->label();

    // Specific DNS record errors
    if ($verification->hasErrors()) {
        foreach ($verification->errors() as $type => $error) {
            echo "$type: $error";
        }
    }
}
DNS changes can take time to propagate. If verification fails immediately after publishing records, wait a few minutes and try again. See Domain Verification troubleshooting for common issues.

API Reference

POST /domains//verify

Delete a Domain

Lettr::domains()->delete('example.com');
Deleting a domain stops all sending from that domain immediately. Emails sent from a deleted domain will fail with a validation error.

API Reference

DELETE /domains/

What’s Next

Sending Domains

DNS setup: SPF, DKIM, DMARC

Webhooks

Receive delivery and engagement events