如何通过API将参数添加到mandrill模板中的所有链接? [英] How to add params to all links in a mandrill template through API?

查看:75
本文介绍了如何通过API将参数添加到mandrill模板中的所有链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在发送之前,我需要为Mandrill模板的所有链接添加一些参数. 例如,模板中有诸如<a href="http://google.com>click here</a>"之类的锚点.

I need to add some params to all links from a Mandrill template before sending. For example, in the template there are anchors like <a href="http://google.com>click here</a>".

我需要添加一个字符串(向每个锚点设置参数集),例如:<a href="http://google.com?param1=value1&param2=value2>click here</a>",动态

What I need is to add a string (set of params to every anchor), like this: <a href="http://google.com?param1=value1&param2=value2>click here</a>", dynamically

是否可以通过API进行操作?类似于 X-MC-GoogleAnalyticsCampaign ,它添加了utm_campaign参数.

Is there a way to do it through the API? Something similar to X-MC-GoogleAnalyticsCampaign which adds the utm_campaign param.

推荐答案

当然,您可以使用合并标记执行此操作.您的链接看起来像这样:

Sure, you can use merge tags to do this. Your link would look something like this:

<a href="http://google.com?param1=*|PARAM1|*&param2=*|PARAM2|*">click here</a>

然后,您想要在SMTP标头或API调用中传递PARAM1和PARAM2的值.

You'd then want to pass the values for PARAM1 and PARAM2 in the SMTP headers, or in your API call.

对于SMTP,您可以使用 X-MC-MergeVars 标头.以下是有关该特定标头的更多信息: http ://help.mandrill.com/entries/21688056-Using-SMTP-Headers-to-customize-your-messages#mergetags

For SMTP, you'd use the X-MC-MergeVars header. Here's more information on that specific header: http://help.mandrill.com/entries/21688056-Using-SMTP-Headers-to-customize-your-messages#mergetags

如果您使用的是API(消息/发送或消息/发送模板),则需要使用 merge_vars global_merge_vars 参数来设置PARAM1和PARAM2的值( merge_vars 用于特定于收件人的信息,而 global_merge_vars 用于该API调用中的所有收件人).

If you're using the API (messages/send or messages/send-template), you'd want to use the merge_vars or global_merge_vars parameters to set the values for PARAM1 and PARAM2 (merge_vars is for recipient-specific info, while global_merge_vars is for all recipients in that API call).

有关使用合并标记通过Mandrill创建动态内容的一般概述:

General overview on using merge tags to create dynamic content with Mandrill: http://help.mandrill.com/entries/21678522-How-do-I-use-merge-tags-to-add-dynamic-content-

这篇关于如何通过API将参数添加到mandrill模板中的所有链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆