Enhancing Deliverability with List-Unsubscribe Headers in Piisend
Learn how to implement the List-Unsubscribe header for one-click unsubscribes in your marketing emails using Piisend, ensuring compliance and improving deliverability. Understand when to include or omit this crucial header.
Section 1
Understanding the List-Unsubscribe Header for Email Compliance
The List-Unsubscribe header is a critical component for marketing email compliance and a cornerstone of good deliverability. It provides recipients with an easy, often one-click unsubscribe mechanism directly from their email client, reducing the likelihood of them marking your emails as spam. Adhering to standards like the CAN-SPAM Act often requires such a clear unsubscribe path, which in turn helps maintain a positive sender reputation.
Section 2
Adding One-Click Unsubscribe to Marketing Emails with Piisend
Piisend makes it straightforward to include the List-Unsubscribe header in your outgoing marketing emails. You can specify this header in your API request, providing both a mailto address for direct email unsubscribes and an http URL for web-based unsubscribe pages. This dual approach ensures maximum compatibility across various email clients and enhances the user experience for one-click unsubscribe.
1curl -X POST https://api.piisend.com/api/v1/emails \2 -H "Authorization: Bearer YOUR_API_KEY" \3 -H "Content-Type: application/json" \4 -d '{5 "to": ["marketing-subscriber@example.com"],6 "subject": "Our Latest Newsletter",7 "html": "<h1>Check out our new products!</h1><p>...</p>",8 "text": "Check out our new products! ...",9 "headers": {10 "List-Unsubscribe": "<mailto:unsubscribe@yourdomain.com?subject=Unsubscribe>, <https://yourdomain.com/unsubscribe?email=marketing-subscriber@example.com>"11 }12 }'Section 3
Transactional vs. Marketing: When to Omit List-Unsubscribe
It's crucial to distinguish between transactional email and marketing emails. While List-Unsubscribe is vital for marketing campaigns, it should generally be omitted from transactional messages such as OTP verification email, password reset email, or order confirmation email. These emails are expected and often legally required, and providing an unsubscribe option can confuse users or even compromise security. Piisend's API allows you to control headers on a per-email basis, ensuring you apply best practices for each email type.
1const fetch = require('node-fetch');2 3async function sendTransactionalEmail() {4 const response = await fetch('https://api.piisend.com/api/v1/emails', {5 method: 'POST',6 headers: {7 'Authorization': 'Bearer YOUR_API_KEY',8 'Content-Type': 'application/json'9 },10 body: JSON.stringify({11 to: ['user@example.com'],12 subject: 'Your Order Confirmation #12345',13 html: '<p>Thank you for your order!</p>',14 text: 'Thank you for your order!'15 })16 });17 18 const data = await response.json();19 console.log(data);20}21 22sendTransactionalEmail();