mailjet / mailjet-apiv3-php

[API v3] Mailjet PHP Wrapper
http://dev.mailjet.com
MIT License
267 stars 86 forks source link

mjml creation throws error in mailjet ui #311

Open nadar opened 2 weeks ago

nadar commented 2 weeks ago

Hi Mailjet Developer Team,

For the past two weeks, emails created through the API using an MJML template have stopped working. Unfortunately, support has not provided any solutions, only requesting more information that doesn’t seem relevant to the issue.

The same problem appeared about a month ago, was resolved by Mailjet, but has now returned.

We haven’t made any changes on our end, and our unit tests confirm that the MJML remains consistent. This strongly suggests the issue is on Mailjet's side.

Here is an example request (with some unnecessary details removed):

$body = [
    'Name' => $title,
    'Description' => $description,
    'EditMode' => 4,
    'IsStarred' => true,
    'IsTextPartGenerationEnabled' => true,
    'OwnerType' => 'apikey',
    'Purposes' => ['marketing'],
    'Categories' => ['newsletter'],
];

$response = $this->getClient()->post(Resources::$Template, ['body' => array_filter($body)]);
$id = $response->getData()[0]['ID'];

$body = [
    'Headers' => [
        'Subject' => $title,
    ],
    'MJMLContent' => $mjml,
];

$this->getClient()->post(Resources::$TemplateDetailcontent, ['id' => $id, 'body' => $body]);

example mjml content or any other template from mjml.io

<mjml> <mj-body> <mj-section> <mj-column> <mj-text font-size="20px" color="#F45E43" font-family="helvetica">foobar!</mj-text> </mj-column> </mj-section> <mj-section> <mj-column> <mj-text>Hello World</mj-text> <mj-text>This is a teaser</mj-text> </mj-column> </mj-section> <mj-section> <mj-column> <mj-text>Hello World 2</mj-text> <mj-text>This is a teaser 2</mj-text> </mj-column> </mj-section> </mj-body> </mjml>
oleksandr-mykhailenko commented 2 weeks ago

Hello @nadar We are working on that. For now we do not see any issues from the library code, but anyway, we are working. Because it could be related to another server part

nadar commented 2 weeks ago

Yes i am aware its not the client library, but the support does not answer or takes care of the problem. So i thought a discussion between developers might help, its urgent, and persists since two weeks, the 500xhr exception should be in your error tracking system ;-)

Error from the UI

image

500-er response:

image

nadar commented 2 weeks ago

The "htmlPart" is not part of the request, when we use "MJMLContent" - so the request will not have htmlPart variable and for whatever reason the request requires this, based on the exception from the ui :-)

oleksandr-mykhailenko commented 2 weeks ago

Oh, that's not good. So we are working on it. Looks like a lack of API docs and library right now (

nadar commented 1 week ago

Any news @oleksandr-mykhailenko on this? It seems Mailjet really don't care about.

oleksandr-mykhailenko commented 1 week ago

Any news @oleksandr-mykhailenko on this? It seems Mailjet really don't care about.

Unfortunately, for now I do not have any updates. Testing wrapper with php 8.2 and 8.3 give same results. For some reason, server side does something with the data. It looks like that, but can't be sure. What I can say for sure, we are working on that and keep testing