This guide covers SMTP integration. For full configuration options and available headers, see the SMTP Introduction.
Installation
Install PHPMailer via Composer:
Code
composer require phpmailer/phpmailer
Basic Configuration
Use environment variables for credentials:
Code
<?php// Load from environment or config$smtpHost = 'smtp.lettermint.co';$smtpUsername = 'lettermint';$smtpPassword = getenv('LETTERMINT_API_TOKEN'); // Your API token
Add Lettermint-specific headers for tags, metadata, and routing:
Code
// Tag for categorization$mail->addCustomHeader('X-LM-Tag', 'order-confirmation');// Metadata for tracking (included in webhooks)$mail->addCustomHeader('X-LM-Metadata-order_id', '12345');$mail->addCustomHeader('X-LM-Metadata-customer_id', 'cust_789');// Route selection$mail->addCustomHeader('X-Lettermint-Route', 'transactional');
See the SMTP Introduction for full details on available headers and their formats.