Add metadata that will be included in webhook payloads:
Code
const mailOptions = { from: 'sender@yourdomain.com', to: 'recipient@example.com', subject: 'Order Confirmation', html: '<p>Your order has been confirmed.</p>', headers: { 'X-LM-Metadata-order_id': '12345', 'X-LM-Metadata-customer_id': 'cust_789', 'X-LM-Metadata-campaign': 'order_confirmation', },};
Lettermint Headers
Add Lettermint-specific headers for tags, metadata, and routing:
Code
const mailOptions = { from: 'sender@yourdomain.com', to: 'recipient@example.com', subject: 'Order Confirmation', html: '<p>Your order has been confirmed.</p>', headers: { // Tag for categorization 'X-LM-Tag': 'order-confirmation', // Metadata for tracking (included in webhooks) 'X-LM-Metadata-order_id': '12345', 'X-LM-Metadata-customer_id': 'cust_789', // Route selection 'X-Lettermint-Route': 'transactional', },};
Metadata headers are extracted by Lettermint and included in webhook payloads, but not added to the actual email sent to recipients.
See the SMTP Introduction for full details on available headers.