Reputation: 1144
I'm trying to make it so when someone clicks on the unsubscribe link in an email sent via the Mandrill API (using PHP) it works as described in: http://help.mandrill.com/entries/23815367-Can-I-add-an-automatic-unsubscribe-link-to-Mandrill-emails-
The *|UNSUB|*
merge tag is not getting parsed. It just comes through in the the body of the email received.
Near the end of the message content ($message_content) I have:
<a href="*|UNSUB:http:/mydomain.com/unsubscribe-from-mailing-lists/|*">Click here to unsubscribe.</a>
In Gmail, the link is: Click here to unsubscribe. (NOT a valid HREF, so Gmail just ignores the anchor tag)
In Outlook 2010 the link is: Click here to unsubscribe. (Not a valid HREF)
Is there some merge_vars parameter I should add to the headers? http://help.mandrill.com/entries/21678522-How-do-I-use-merge-tags-to-add-dynamic-content- mentions them, but I can't find what the parameter should be for the UNSUB merge tag.
$mandrill = new Mandrill($mandrill_api_key);
$message = array(
'html' => $message_content,
'subject' => $subject,
'from_email' => '[email protected]',
'from_name' => 'MY NAME',
'to' => $to_list,
'headers' => array('Reply-To' => '[email protected]'),
'important' => false,
'track_opens' => 1,
'track_clicks' => null,
'auto_text' => null,
'auto_html' => null,
'inline_css' => null,
'url_strip_qs' => null,
'preserve_recipients' => 0,
'view_content_link' => 1,
'tracking_domain' => null,
'signing_domain' => null,
'return_path_domain' => null,
'merge' => true,
'global_merge_vars' => array(
array(
'unsub' => 'unsub'
)
),
);
What step am I missing? TIA!
Upvotes: 1
Views: 1829
Reputation: 1144
The problem was the URL was missing a slash (http:/mydomain...)
This was caused by TinyMCE converting URLs. I added convert_urls: false
to the tinymce.init and that solved my problem.
Kudos to Mandrill Support for helping me identify the problem.
Upvotes: 1