--- name: poplar-direct-mail description: Design and send programmatic direct mail using Poplar's HTML templates and API. Use for creating dynamic mail pieces (postcards, bifolds, trifolds, letters) with personalization and triggering mail via API. --- # Poplar Direct Mail ## Overview Design professional direct mail creative using Poplar's HTML template system and send programmatic mail pieces via their API. This skill covers template creation with dynamic personalization, API integration for triggered mailings, and creative best practices for high-converting direct mail campaigns. ## When to Use - Creating HTML templates for direct mail postcards, bi-folds, tri-folds, or letters - Building triggered/programmatic direct mail campaigns - Integrating direct mail into marketing automation workflows - Designing personalized mail pieces with dynamic content (names, offers, QR codes) - Sending transactional mail (receipts, confirmations, statements) - Setting up abandoned cart or win-back mail campaigns ## Prerequisites - Poplar account ([heypoplar.com](https://heypoplar.com)) - API access token from [Poplar Credentials](https://app.heypoplar.com/credentials) - Python 3.9+ (for scripts) - `requests` package ## Installation ```bash pip install requests ``` Set your API token: ```bash # Test token (for development - only works with mailing endpoint) export POPLAR_API_TOKEN="test_your_token_here" # Production token (for live mailings) export POPLAR_API_TOKEN="your_production_token_here" ``` ## Mail Formats & Dimensions ### Postcards | Size | Final Trim | With Bleed | Pixels (300 PPI) | |------|------------|------------|------------------| | 4" x 6" | 4" x 6" | 4.25" x 6.25" | 1275 x 1875 | | 6" x 9" | 6" x 9" | 6.25" x 9.25" | 1875 x 2775 | | 6" x 11" | 6" x 11" | 6.25" x 11.25" | 1875 x 3375 | **Best for:** Retargeting, time-sensitive promotions, simple messaging, direct mail newcomers ### Bi-folds | Format | Pixels (300 PPI) | |--------|------------------| | Short-fold (folds left to right) | 1725 x 5175 | | Long-fold (folds top to bottom) | 3375 x 2625 | **Best for:** Prospecting campaigns, new product launches, complex value propositions ### Tri-folds | Format | Pixels (300 PPI) | |--------|------------------| | Standard Tri-fold | 2625 x 4987 | **Best for:** Multiple product selections, detailed information, catalogs ### Letters | Format | Dimensions | |--------|------------| | 8.5" x 11" (Color or B&W) | 612 x 792 px (no bleed required) | **Best for:** Financial/insurance, sensitive content, transactional mailings, professional communications ## HTML Template Structure ### Basic Template ```html
Special Offer Inside!
Hi {{recipient.first_name | default: "Friend"}},
Use code: {{promotion.promo_code}}
``` ### CSS Requirements | Requirement | Details | |-------------|---------| | CSS Location | All styles in `
{{recipient.first_name | capitalize}}, You're Invited!
Exclusive offer just for you
25%
Off Everything
``` ### 4x6 Postcard - Back (with QR Code) ```html
Shop our entire collection with your
exclusive discount. Free shipping on
orders over $50!
Your Code
{{promotion.promo_code}}
Expires: {{ "now" | date: "%s" | plus: 2592000 | date: "%B %e, %Y" }}
Scan to shop
Scan to shop now
``` ## Troubleshooting ### Template Issues **"Unsupported unit" error** - Use only `in` or `px` units, not `em`, `rem`, `vw`, `vh`, or `%` **Images not appearing** - Ensure all image URLs are absolute (full URLs starting with `https://`) - Verify URLs are publicly accessible (test in incognito browser) - Check file size is under 5MB **Fonts not rendering** - Use Google Fonts or self-hosted font files - Typekit and Adobe Fonts are not supported - Include all font weights you use in the `` tag **Merge tags not replaced** - Check column headers in your data match merge tag names exactly - Verify Liquid syntax is correct (no typos) - Use `| default: "fallback"` for optional fields ### API Issues **401 Unauthorized** - Verify your API token is correct - Check if using test token for non-mailing endpoints (test tokens only work for `/mailing`) **400 Bad Request** - Campaign must be active - Creative must be uploaded - Required recipient fields: `address_1`, `city`, `state`, `postal_code` **Campaign not active error** - Activate the campaign in the Poplar dashboard before sending ### Preview Differences **Browser vs PDF preview differ** - Always check the PDF proof from Poplar, not browser preview - HTML-to-PDF conversion may render some CSS differently - Avoid CSS features not well-supported in PDF rendering ## Resources - [Poplar Documentation](https://docs.heypoplar.com) - [API Reference](https://docs.heypoplar.com/api) - [Template Downloads](https://docs.heypoplar.com/creative-design/templates-and-specs) - [Creative Best Practices](https://heypoplar.com/articles/creative-best-practices) - [Support](mailto:support@heypoplar.com)