Laravel 使用 Mailgun 发送电子邮件时获得唯一 ID
Laravel get unique id when sending emails with Mailgun
我查看了 mailguns api,每当他们发送 webhook 时,他们也会发送这个 ID:
"id": "-laxIqj9QWubsjY_3pTq_g",
我猜这是他们每封电子邮件的唯一 ID。有什么方法可以在发送电子邮件时获取 ID,以便我可以跟踪我收到的是哪封电子邮件?我不能只通过收件人电子邮件搜索,我需要一些唯一的 ID。这是我发送电子邮件的方式:
Mail::send('email.subscription', $data, function ($message) use ($email)
{
$message->to($email)->subject('Welcome')->from('no-reply@name.com', 'My Name');
});
您可以在发送时创建自己的唯一 ID(也许是 DB 自动递增 ID 或 GUID)。
然后您可以使用 "attach data to messages" 功能在发送电子邮件时添加该唯一 ID。 https://documentation.mailgun.com/en/latest/user_manual.html#attaching-data-to-messages
它将数据发送回 webhook。请参阅跟踪 "opens" webhook 中的 "Custom Variables":https://documentation.mailgun.com/en/latest/user_manual.html#tracking-opens
我查看了 mailguns api,每当他们发送 webhook 时,他们也会发送这个 ID:
"id": "-laxIqj9QWubsjY_3pTq_g",
我猜这是他们每封电子邮件的唯一 ID。有什么方法可以在发送电子邮件时获取 ID,以便我可以跟踪我收到的是哪封电子邮件?我不能只通过收件人电子邮件搜索,我需要一些唯一的 ID。这是我发送电子邮件的方式:
Mail::send('email.subscription', $data, function ($message) use ($email)
{
$message->to($email)->subject('Welcome')->from('no-reply@name.com', 'My Name');
});
您可以在发送时创建自己的唯一 ID(也许是 DB 自动递增 ID 或 GUID)。
然后您可以使用 "attach data to messages" 功能在发送电子邮件时添加该唯一 ID。 https://documentation.mailgun.com/en/latest/user_manual.html#attaching-data-to-messages
它将数据发送回 webhook。请参阅跟踪 "opens" webhook 中的 "Custom Variables":https://documentation.mailgun.com/en/latest/user_manual.html#tracking-opens