Use this file to discover all available pages before exploring further.
Before you can send email, the sending domain must be verified in Lettr. The $lettr->domains() service lets you manage domains programmatically — useful for multi-tenant apps that onboard customer domains, or for automating DNS verification checks.For the concepts behind domain setup (SPF, DKIM, DMARC, tracking domains), see Sending Domains.
$domain = $lettr->domains()->get('example.com');echo $domain->domain;echo $domain->status->value;echo $domain->canSend;echo $domain->dkimStatus?->label(); // DnsStatus enumecho $domain->cnameStatus?->label();echo $domain->dmarcStatus?->label();echo $domain->spfStatus?->label();echo $domain->trackingDomain;echo $domain->createdAt;// DKIM record helpersif ($domain->dkim !== null) { echo $domain->dkim->recordName('example.com'); // Full DNS record name echo $domain->dkim->recordValue(); // Full DNS record value}
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.