api-documentation
api-documentation copied to clipboard
custom headers with smpt relay
When I'm sending custom headers using SMTP relay, my mayljet transactional template is assigned correctly with the X-MJ-TemplateID but X-MJ-Vars variables are not included in the content of the template. Any idea what I'm doing wrong?
Code in PHPMailer: $mail->addCustomHeader('X-MJ-TemplateID','xxxxx'); $mail->addCustomHeader('X-MJ-TemplateLanguage','true'); $mail->addCustomHeader('X-MJ-Vars','{"name":"xxx", "city:xxx"}');
Hi @thber190356,
use $mail->addCustomHeader('X-MJ-TemplateLanguage','1');
instead
Hello @thber190356 @AntoineGuestin I've the same issue implementing it via Symfony: no way to get the Vars values in sent mail when other headers are OK :( @thber190356 did you finally found a solution ? thanks a lot
I found a solution for this issue! You MUST pass the Json object as string.
I used
'X-MJ-Vars': JSON.stringify(variables)}
and it worked