I found an error while trying to use the API. I have a template that if I test it on https://mjml.io/try-it-live it works correctly, however when using the API the returning htlm is wrong and almost empty.
The error can be reproduced with the next CURL call:
curl -X POST \
https://api.mjml.io/v1/render \
-H 'Authorization: Basic XXXXXXXXX' \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/json' \
-H 'Postman-Token: 2ba73707-fe2a-4c21-b43e-7311dc3ba4c9' \
-d '{
"mjml":"<mjml> <mj-head> <mj-title>Titulo email</mj-title> <mj-attributes> <mj-font name='\''Roboto'\'' href='\''https://fonts.googleapis.com/css?family=Roboto'\'' /> <mj-all font-family='\''Roboto, Arial'\'' text-align='\''left'\'' color='\''#656565'\'' font-size='\''16px'\''/> <!-- Variables color de fondo --> <mj-class name='\''bg-primary'\'' background-color='\''#2c00f8'\'' /> <mj-class name='\''bg-secondary'\'' background-color='\''#660000'\'' /> <mj-class name='\''bg-terciary'\'' background-color='\''#4cbb5f'\'' /> <!-- Variables color de tipografia --> <mj-class name='\''color-primary'\'' color='\''#656565'\'' /> <mj-class name='\''color-secondary'\'' color='\''#ffffff'\'' /> <mj-class name='\''color-terciary'\'' color='\''#212121'\'' /> <mj-class name='\''color-cuaternary'\'' color='\''#4cbb5f'\'' /> <!-- Helpers tamaño de tipografia --> <mj-class name='\''small'\'' font-size='\''10px'\'' line-height='\''11px'\'' /> <mj-class name='\''regular'\'' font-size='\''13px'\'' /> <mj-class name='\''big'\'' font-size='\''16px'\'' /> <mj-class name='\''big-price'\'' font-size='\''18px'\'' /> <!-- Helpers generales --> <mj-class name='\''bold'\'' font-weight='\''700'\'' /> <mj-class name='\''upper'\'' text-transform='\''uppercase'\'' /> <mj-class name='\''no-bt-padding'\'' padding-bottom='\''0'\''/> <mj-class name='\''no-tp-padding'\'' padding-top='\''0'\''/> <mj-class name='\''small-padding'\'' padding-top='\''10px'\'' padding-bottom='\''10px'\''/> <mj-class name='\''text-right'\'' text-align='\''right'\'' /> <mj-class name='\''full-width'\'' width='\''100%'\'' /> <mj-class name='\''primary-button'\'' height='\''45px'\'' width='\''100%'\'' color='\''#4cbb5f'\'' border='\''2px solid #4cbb5f'\'' background-color='\''transparent'\'' /> </mj-attributes> </mj-head> <mj-body> <mj-section mj-class='\''no-bt-padding'\''> <mj-column> <mj-text mj-class='\''regular'\''>11 de Octubre 2017</mj-text> </mj-column> </mj-section> <mj-section mj-class='\''no-tp-padding'\''> <mj-column> <mj-image align='\''left'\'' width='\''139px'\'' height='\''50px'\'' src='\''/img/logo.png'\''></mj-image> </mj-column> <mj-column> <mj-text width='\''400px'\'' mj-class='\''color-terciary'\'' font-size='\''26px'\'' line-height='\''30px'\''>Titulo Lorem ipsum dolor sit amet</mj-text> </mj-column> </mj-section> <mj-section mj-class='\''no-bt-padding'\''> <mj-column> <mj-text mj-class='\''regular no-bt-padding'\''>Vehiculo</mj-text> <mj-text mj-class='\''color-terciary'\''>Volkswagen / Golf GTI / Performance</mj-text> </mj-column> </mj-section> <mj-section> <mj-column> <mj-text mj-class='\''regular no-bt-padding'\''>Aplazamiento en meses</mj-text> <mj-text mj-class='\''color-terciary'\''>3 meses: Desde enero 2018</mj-text> </mj-column> </mj-section> <mj-section mj-class='\''no-bt-padding'\''> <mj-column> <mj-table> <tr> <td style='\''padding-bottom:20px;'\''>Precio vehiculo</td> <td align='\''right'\'' style='\''font-weight:bold; font-size:18px; padding-bottom:20px; color:#212121;'\''> <span> <img height='\''15px'\'' src='\''/img/check.png'\'' style='\''border:0;outline:none;text-decoration:none;margin-right:25px;'\'' width='\''19'\'' /> 24.900,00 € </span> </td> </tr> <tr> <td style='\''padding-bottom:20px;'\''>Extras</td> <td align='\''right'\'' style='\''padding-bottom:20px; color:#212121;'\''>240,00 €</td> </tr> <tr> <td style='\''padding-bottom:20px;'\''>Descuento</td> <td align='\''right'\'' style='\''padding-bottom:20px; color:#212121;'\''>490,00 €</td> </tr> <tr> <td>Entrada</td> <td align='\''right'\'' style='\''color:#212121;'\''>5.400,00 €</td> </tr> </mj-table> </mj-column> </mj-section> <mj-section> <mj-column> <mj-divider border-width='\''1px'\'' border-style='\''solid'\'' border-color='\''#666666'\'' /> </mj-column> </mj-section> <mj-section mj-class='\''no-tp-padding'\''> <mj-column> <mj-table> <tr> <td >Importe total solicitado</td> <td align='\''right'\'' style='\''font-weight:bold; font-size:18px; color:#212121;'\''>19.740,00 €</td> </tr> </mj-table> </mj-column> </mj-section> <mj-section mj-class='\''no-bt-padding'\''> <mj-column> <mj-table> <tr> <td style='\''padding-bottom:20px;'\''>Importe total a financiar*</td> <td align='\''right'\'' style='\''padding-bottom:20px; color:#212121;'\''>20.179,30 €</td> </tr> <tr> <td>Mensualidades</td> <td align='\''right'\'' style='\''font-weight:bold; font-size:18px; color:#212121;'\''>36</td> </tr> </mj-table> </mj-column> </mj-section> <mj-section> <mj-column> <mj-divider border-width='\''1px'\'' border-style='\''solid'\'' border-color='\''#666666'\'' /> </mj-column> </mj-section> <mj-section mj-class='\''no-bt-padding'\''> <mj-column> <mj-text mj-class='\''big-price bold color-cuaternary'\''>Oferta Balloon</mj-text> </mj-column> </mj-section> <mj-section mj-class='\''no-bt-padding no-tp-padding'\''> <mj-column> <mj-table> <tr> <td style='\''padding-bottom:20px;'\''>Cuota mensual</td> <td align='\''right'\'' style='\''padding-bottom:20px; color:#212121;'\''>305,09 €</td> </tr> <tr> <td style='\''padding-bottom:20px;'\''>Prima mensual del seguro**</td> <td align='\''right'\'' style='\''font-size:18px; padding-bottom:20px; color:#212121;'\''>34,98 €</td> </tr> </mj-table> </mj-column> </mj-section> <mj-section mj-class='\''bg-terciary small-padding'\''> <mj-column> <mj-table mj-class='\''color-secondary'\''> <tr> <td>Importe total a domiciliar</td> <td align='\''right'\'' style='\''font-size:32px; font-weight:bold;'\''>340,07 €</td> </tr> </mj-table> </mj-column> </mj-section> <mj-spacer height='\''40px'\'' /> <mj-section mj-class='\''no-tp-padding no-bt-padding'\''> <mj-column> <mj-table mj-class='\''color-cuaternary'\''> <tr> <td>Valor futuro garantizado</td> <td align='\''right'\''>7.456,00 €</td> </tr> </mj-table> </mj-column> </mj-section> <mj-section mj-class='\''no-bt-padding'\''> <mj-column> <mj-text mj-class='\''small no-bt-padding'\''>Cuota mensual ultima cuota: 7.456,00 €</mj-text> <mj-text mj-class='\''small no-tp-padding no-bt-padding'\''>Prima mensual del seguro : 34,98 €</mj-text> <mj-text mj-class='\''small no-tp-padding no-bt-padding'\''>Importe mensual a domiciliar ultima cuota: 7.498,98 €</mj-text> <mj-text mj-class='\''small no-tp-padding no-bt-padding'\''>TIN: 6.95 %</mj-text> <mj-text mj-class='\''small no-tp-padding no-bt-padding'\''>TAE: 7,18 %</mj-text> <mj-text mj-class='\''small no-tp-padding'\''>Importe total adeudado: 20.303,12 €</mj-text> </mj-column> </mj-section> <mj-spacer height='\''40px'\'' /> <mj-section mj-class='\''no-bt-padding'\''> <mj-column> <mj-text mj-class='\''big-price bold color-cuaternary'\''>Oferta Regular</mj-text> </mj-column> </mj-section> <mj-section mj-class='\''no-bt-padding no-tp-padding'\''> <mj-column> <mj-table> <tr> <td style='\''padding-bottom:20px;'\''>Cuota mensual</td> <td align='\''right'\'' style='\''padding-bottom:20px; color:#212121;'\''>552,72 €</td> </tr> <tr> <td style='\''padding-bottom:20px;'\''>Prima mensual del seguro**</td> <td align='\''right'\'' style='\''padding-bottom:20px; color:#212121;'\''>34,98 €</td> </tr> </mj-table> </mj-column> </mj-section> <mj-section mj-class='\''bg-terciary small-padding'\''> <mj-column> <mj-table mj-class='\''color-secondary'\''> <tr> <td>Importe total a domiciliar</td> <td align='\''right'\'' style='\''font-size:32px; font-weight:bold;'\''>587,10 €</td> </tr> </mj-table> </mj-column> </mj-section> <mj-section mj-class='\''no-bt-padding'\''> <mj-column> <mj-text mj-class='\''small no-tp-padding no-bt-padding'\''>TIN: 6.95 %</mj-text> <mj-text mj-class='\''small no-tp-padding no-bt-padding'\''>TAE: 7,18 %</mj-text> <mj-text mj-class='\''small no-tp-padding'\''>Importe total adeudado: 20.303,12 €</mj-text> </mj-column> </mj-section> <mj-section> <mj-column> <mj-button href='\''#'\'' mj-class='\''primary-button'\''> <span> <img height='\''24px'\'' src='\''/img/poi.png'\'' style='\''vertical-align:sub;border:0;outline:none;text-decoration:none;margin-right:25px;'\'' width='\''20'\'' /> <span>Encuentra el concesionario más cercano</span> </span> </mj-button> </mj-column> </mj-section> <mj-section mj-class='\''no-bt-padding'\''> <mj-column> <mj-text mj-class='\''small no-tp-padding'\''>* Gastos de formalización 3,00 % incuidos. En esta simulación 345,92 €</mj-text> </mj-column> </mj-section> <mj-section mj-class='\''no-bt-padding'\''> <mj-column> <mj-text mj-class='\''small no-tp-padding'\''>** Texto legal seguro. Sed non vehicula mauris. Donec a ante a eros tristique tincidunt. Duis quis enim vel sem tristique imperdiet. Integer sit amet metus felis. Sed finibus ante id fermentum ultricies. Morbi ornare, est a tristique vulputate, nisl ipsum congue ligula, ut pharetra purus ligula sed neque. Aenean cursus lorem at risus sollicitudin facilisis.</mj-text> </mj-column> </mj-section> <mj-section mj-class='\''no-bt-padding'\''> <mj-column> <mj-text mj-class='\''small no-tp-padding'\''>Ejemplo para un préstamo de 10.000€ a 96 meses TIN 6,95% TAE 7,18% mensualidad 136,09€. Importe total adeudado 13.064,64€. Ejemplo para un préstamo de 5.000€ a 60 meses TIN 15,90% TAE 17,11% mensualidad 121,32€. Importe total adeudado, 7.279,20€. Para importes de préstamo desde 3.000€ hasta 50.000€. TIN desde 6,95% (7,18%TAE mínima) hasta 15,90% (17,11%TAE máxima). Duración comprendida entre 3 y 120 meses. El TIN podrá variar en función del importe, la duración y el destino del préstamo. Para destino préstamo Reunificación de Deudas el plazo máximo es de 120 meses y para Resto destinos el plazo máximo es de 96 meses. Para importe de préstamo inferior a 10.000€ el plazo máximo es de 60 meses, para importe igual o mayor a 10.000€ el plazo máximo es de 120 meses Oferta sujeta a la autorización previa de Banco Cetelem S.A.U. tras el estudio de la documentación aportada y la firma del contrato.</mj-text> </mj-column> </mj-section> <mj-spacer height='\''40px'\'' /> </mj-body> </mjml>"
}'
Expected behavior:
The HTML returned should be the same that return the "Try It Live" page:
The API hasn't yet been migrated to MJML4 as stated here #1197 so that's
why.
On Wed, Jun 20, 2018 at 11:08 PM Arnaldo Trujillo Falcón <
notifications@github.com> wrote:
I found an error while trying to use the API. I have a template that if I
test it on https://mjml.io/try-it-live it works correctly, however when
using the API the returning htlm is wrong and almost empty.
The error can be reproduced with the next CURL call:
<mj-section mj-class='\''no-bt-padding'\''> <mj-text mj-class='\''small no-tp-padding no-bt-padding'\''>TIN: 6.95 % <mj-text mj-class='\''small no-tp-padding no-bt-padding'\''>TAE: 7,18 % <mj-text mj-class='\''small no-tp-padding'\''>Importe total adeudado: 20.303,12 € <mj-button href='\''#'\'' mj-class='\''primary-button'\''> <img height='\''24px'\'' src='\''/img/poi.png'\'' style='\''vertical-align:sub;border:0;outline:none;text-decoration:none;margin-right:25px;'\'' width='\''20'\'' /> Encuentra el concesionario más cercano <mj-section mj-class='\''no-bt-padding'\''> <mj-text mj-class='\''small no-tp-padding'\''> Gastos de formalización 3,00 % incuidos. En esta simulación 345,92 € <mj-section mj-class='\''no-bt-padding'\''> <mj-text mj-class='\''small no-tp-padding'\''>** Texto legal seguro. Sed non vehicula mauris. Donec a ante a eros tristique tincidunt. Duis quis enim vel sem tristique imperdiet. Integer sit amet metus felis. Sed finibus ante id fermentum ultricies. Morbi ornare, est a tristique vulputate, nisl ipsum congue ligula, ut pharetra purus ligula sed neque. Aenean cursus lorem at risus sollicitudin facilisis. <mj-section mj-class='\''no-bt-padding'\''> <mj-text mj-class='\''small no-tp-padding'\''>Ejemplo para un préstamo de 10.000€ a 96 meses TIN 6,95% TAE 7,18% mensualidad 136,09€. Importe total adeudado 13.064,64€. Ejemplo para un préstamo de 5.000€ a 60 meses TIN 15,90% TAE 17,11% mensualidad 121,32€. Importe total adeudado, 7.279,20€. Para importes de préstamo desde 3.000€ hasta 50.000€. TIN desde 6,95% (7,18%TAE mínima) hasta 15,90% (17,11%TAE máxima). Duración comprendida entre 3 y 120 meses. El TIN podrá variar en función del importe, la duración y el destino del préstamo. Para destino préstamo Reunificación de Deudas el plazo máximo es de 120 meses y para Resto destinos el plazo máximo es de 96 meses. Para importe de préstamo inferior a 10.000€ el plazo máximo es de 60 meses, para importe igual o mayor a 10.000€ el plazo máximo es de 120 meses Oferta sujeta a la autorización previa de Banco Cetelem S.A.U. tras el estudio de la documentación aportada y la firma del contrato. <mj-spacer height='\''40px'\'' /> "
}'
Expected behavior:
The HTML returned should be the same that return the "Try It Live" page:
Gastos de formalización 3,00 % incuidos. En esta simulación 345,92 €
** Texto legal seguro. Sed non vehicula mauris. Donec a ante a eros tristique tincidunt. Duis quis enim vel sem tristique imperdiet. Integer sit amet metus felis. Sed finibus ante id fermentum ultricies. Morbi ornare, est a tristique vulputate, nisl ipsum congue ligula, ut pharetra purus ligula sed neque. Aenean cursus lorem at risus sollicitudin facilisis.
Ejemplo para un préstamo de 10.000€ a 96 meses TIN 6,95% TAE 7,18% mensualidad 136,09€. Importe total adeudado 13.064,64€. Ejemplo para un préstamo de 5.000€ a 60 meses TIN 15,90% TAE 17,11% mensualidad 121,32€. Importe total adeudado, 7.279,20€. Para importes de préstamo desde 3.000€ hasta 50.000€. TIN desde 6,95% (7,18%TAE mínima) hasta 15,90% (17,11%TAE máxima). Duración comprendida entre 3 y 120 meses. El TIN podrá variar en función del importe, la duración y el destino del préstamo. Para destino préstamo Reunificación de Deudas el plazo máximo es de 120 meses y para Resto destinos el plazo máximo es de 96 meses. Para importe de préstamo inferior a 10.000€ el plazo máximo es de 60 meses, para importe igual o mayor a 10.000€ el plazo máximo es de 120 meses.
Observed behavior:
The HTML returned is almost empty and don't reflects the mjml template
fields:
<td style=\"word-wrap:break-word;font-size:0px;padding:10px 25px;\" align=\"left\"><div style=\"cursor:auto;color:#656565;font-family:Roboto, Arial;font-size:13px;line-height:22px;text-align:left;\">11 de Octubre 2017
I found an error while trying to use the API. I have a template that if I test it on https://mjml.io/try-it-live it works correctly, however when using the API the returning htlm is wrong and almost empty.
The error can be reproduced with the next CURL call:
Expected behavior:
The HTML returned should be the same that return the "Try It Live" page:
Observed behavior:
The HTML returned is almost empty and don't reflects the mjml template fields:
Returned HTML:
API MJML 3.3.3