-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ambiguity with variables, documentation and Swiftmailer API #5
Comments
Hey, the only solution so far is this: /**
* Configure specific headers for message
* @method configureHeaders
* @param \Swift_Message $message
* @return \Swift_Message
*/
protected function configureHeaders(\Swift_Message $message, $templateId, array $vars)
{
//Configure Headers
$headers = $message->getHeaders();
$headers->addTextHeader('X-MJ-TemplateID', 'xxxxx');
$headers->addTextHeader('X-MJ-TemplateLanguage', "true");
$headers->addTextHeader('X-MJ-Vars', $vars);
return $message;
} If you want to improve our library feel free to create a PR. I think the problem comes from here: MailjetSwiftMailer/SwiftMailer/MessageFormat/BaseMessagePayload.php Lines 64 to 81 in 97b77e6
|
Hey again @clement-michelet , do you have made some further research on this subject?
What we can do is to @latanasov what do you think about this? Note: see this from mailgun, they use json_encode tehplague/swiftmailer-mailgun-bundle#47 |
@clement-michelet hey, I just release https://github.com/mailjet/MailjetSwiftMailer/releases/tag/1.0.6 Try it and reopen this if you have any related issue! |
Hi,
TL;DR: Could you add a documentation on how to pass variables with Swiftmailer which is in compliance with Swiftmailer interfaces ?
From SMTP official documentation :
My expectation is that I must provide a JSON encoded object with all my properties.
That expectation is confirmed by the fact that most documentations about headers use
addTextHeader
method (like here).The prototype of that method is the following :
So nothing warn me that passing a JSON encoded data is wrong at that time.
After digging, I figured out that passing JSON data doesn't work here and I need to pass array data.
So the current way of passing data is in violation with Swiftmailer interfaces. That violation creates noises on static analysis tools. Also, It makes unclear how it works.
Could you add a documentation on how to pass variables with Swiftmailer which is in compliance with Swiftmailer interfaces ?
The text was updated successfully, but these errors were encountered: