【发布时间】:2017-04-03 22:01:46
【问题描述】:
我试图在通过 SendGrid 发送电子邮件时提取自定义参数,并在通过事件通知保存它们时将它们拉入我的数据库。
我设置了事件通知,以便在 SendGrid 处理电子邮件后将其保存到我的数据库中,我只是不知道如何提取我正在发送的自定义参数。
我这样发送参数:
$mail->addCustomArg("campaign", "welcome69");
然后在尝试接收它时遇到问题(在 SendGrid 发布后)
$data = file_get_contents("php://input");
$events = json_decode($data, true);
foreach ($events as $event) {
$sg_event_id = $event['sg_event_id'];
$unique_args = $event['unique_args'];
}
在底部代码片段中,变量 $unique_args 有效,第二个无效。非常感谢任何帮助。
【问题讨论】:
标签: php sendgrid sendgrid-api-v3