Add metadata that will be included in webhook payloads:
Copy
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', },};
When using SMTP, metadata is passed via X-LM-Metadata-* headers. These are extracted by Lettermint and included in webhook payloads, but not added to the actual email sent to recipients.