Mailchimp plugin: support Mailchimp templates and structured HTML templates #142
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The current Mailchimp plugin sends raw HTML as campaign content via the
campaigns/{id}/contentendpoint usinghtmldirectly. It should support:Current behavior
MailchimpService.phpline 105:This sends the raw cross-post message as the entire email HTML — no email wrapper, no header/footer, no unsubscribe link, no responsive design.
Proposed changes
1. Mailchimp template support
Add a
template_idcredential/config field. When set, use the Mailchimp API's template content injection:The Mailchimp API endpoint
PUT /campaigns/{id}/contentsupports bothhtml(raw) andtemplate(template-based) modes.2. List available templates
Add a helper method or AJAX endpoint to fetch the user's Mailchimp templates:
This could populate a dropdown in the service edit form.
3. Built-in structured template (fallback)
When no Mailchimp template ID is configured, wrap the content in a proper responsive email HTML template:
4. Full article content support
The
$messageparameter currently receives the rendered MokoSuiteCross template (e.g.,{title}\n{introtext}\n{url}). For Mailchimp, the default template ininstall.mysql.sqlalready uses HTML:This should be enhanced to optionally include
{fulltext}for sending full article content:New config/credential fields
Add to
mailchimp.xml:Files to modify
source/packages/plg_mokosuitecross_mailchimp/src/Extension/MailchimpService.php— template logic inpublish()source/packages/plg_mokosuitecross_mailchimp/mailchimp.xml— new config fieldssource/packages/plg_mokosuitecross_mailchimp/language/en-GB/*.ini— new language stringsAcceptance Criteria
template_idis set, campaign uses Mailchimp template with section injectiontemplate_idis empty, content is wrapped in responsive email HTMLuse_full_articleoption passes{fulltext}content to Mailchimp