如何在Mailgun php API中设置标题“X-Mailgun-Campaign-Id”?
我正在使用以下代码,但我不知道如何在标题中传递广告系列ID:
Mail::send('email.message', $data, function ($message) use ($data) {
$message->to($data['to_email'], $data['to_name'])
->subject($data['subject'])
->from($data['from_email'], $data['from_name'])
->header('X-Mailgun-Campaign-Id', 'test campaign');
});
答案 0 :(得分:2)
已找到解决方案:
Mail::send('emails.test3', array(), function ($message) {
$message->to('barsnur@gmail.com')
->subject('Смоторим ответа об открытии')
->from('noreply@mg.offer.bz');
$headers = $message->getHeaders();
$headers->addTextHeader('X-Mailgun-Variables', '{"id_message": "666"}');
$headers->addTextHeader('X-Mailgun-Tag', 'test-tag');
$headers->addTextHeader('X-Mailgun-Campaign-Id', 'sDas7d');
});
可用标头列表适用于链接https://documentation.mailgun.com/user_manual.html#sending-via-smtp