好吧,我想我得到了一个可以接受的工作流程 - 通过“自定义变量”。
您可以为每个收件人定义不同的值,这样您就可以发送唯一的 ID,然后在打开的事件上跟踪该 ID。只需为每个发件人保存一个开放时间或更新开放时间即可。
我的发送代码(PHP):
$result = $mg->sendMessage($domain, array(
'from' => '[email protected]>',
'to' => '[email protected], [email protected]',
'subject' => 'Hello %recipient.first% from %recipient.group%!',
'text' => 'Test of Mailgun',
'html' => '<html>It is so simple to send a message.<br/>Right?</html>',
'o:tag' => array('test'),
'o:tracking-opens' => 'yes',
'v:my-custom-data' => '{"my_message_id": %recipient.id%}',
'recipient-variables' => '{
"[email protected]": {"first":"Recipient1", "group":"group1", "id":1},
"[email protected]": {"first":"Recipient2", "group":"group2", "id":2}
}'
));
然后,在每个事件中,您都会收到带有唯一 ID 的响应。
第一封电子邮件的打开事件:
"user-variables": {
"my-custom-data": "{\"my_message_id\": 1}"
},
第二封邮件的打开事件:
"user-variables": {
"my-custom-data": "{\"my_message_id\": 2}"
},