Open adriaandotcom opened 3 years ago
Can't seem to reproduce on my end are you sure you don't have any modification on the final HTML output ?
Closing for now as I'm not able to reproduce your issue
I have same issue. @iRyusa
@adriaanvanrossum How did you solve the problem?
In Apple's Mail app, there are situations where the location of the image is drawn incorrectly depending on the size of the window. I am attaching the image and source below.
I attached the image using the cid inside the email.
import type {
MJMLJsonObject
} from 'mjml-core';
export const content: MJMLJsonObject = {
tagName: 'mjml',
children: [{
tagName: 'mj-body',
attributes: {},
children: [{
tagName: 'mj-section',
attributes: {},
children: [{
tagName: 'mj-column',
children: [{
tagName: 'mj-image',
attributes: {
'padding-right': '0px',
'padding-left': '0px',
src: 'cid:image1',
align: 'center',
width: '600px',
height: 'auto',
'padding-bottom': '0px',
'padding-top': '0px'
}
}],
attributes: {}
}]
}, {
tagName: 'mj-section',
attributes: {},
children: [{
tagName: 'mj-column',
children: [{
tagName: 'mj-image',
attributes: {
'padding-right': '0px',
'padding-left': '0px',
src: 'cid:image2',
align: 'center',
width: '600px',
height: 'auto',
'padding-bottom': '0px',
'padding-top': '0px'
}
}],
attributes: {}
}]
}, {
tagName: 'mj-section',
attributes: {},
children: [{
tagName: 'mj-column',
children: [{
tagName: 'mj-image',
attributes: {
'padding-right': '0px',
'padding-left': '0px',
src: 'https://9pl9.mjt.lu/tplimg/9pl9/b/xujmm/vg5z1.png',
align: 'center',
width: '600px',
height: 'auto',
'padding-bottom': '0px',
'padding-top': '0px'
}
}],
attributes: {}
}]
}, ]
}],
attributes: {}
};
import aws from 'aws-sdk';
import mjml2html from 'mjml';
import nodemailer from 'nodemailer';
import { content } from './content';
nodemailer
.createTransport({
SES: {
ses: new aws.SES({
apiVersion: '2010-12-01',
credentials: new aws.SharedIniFileCredentials({
profile: 'chaz-dev'
}),
region: 'us-west-1'
}),
aws
}
})
.sendMail({
from: '',
to: '',
subject: 'sample mail',
text: 'test mail',
html: mjml2html(content).html,
attachments: [
{
filename: 'image1.jpg',
path: '../../../resources/image1.jpg',
cid: 'image1'
},
{
filename: 'image2.png',
path: '../../../resources/image2.png',
cid: 'image2'
}
]
});
MJML environment (please complete the following information):
Email sending environment(for rendering issues):
Affected email clients (for rendering issues):
.eml
file attached!
sample mail.zip
Without a MJML to reproduce it's too hard to help you here.
@iRyusa Oh, I see! Sorry, I uploaded the mjml using json before. I attached the mjml below!
<mj-body>
<mj-section>
<mj-column>
<mj-image align="center" height="auto" padding-bottom="0px" padding-left="0px" padding-right="0px" padding-top="0px" src="cid:image1" width="600px"></mj-image>
</mj-column>
</mj-section>
<mj-section>
<mj-column>
<mj-image align="center" height="auto" padding-bottom="0px" padding-left="0px" padding-right="0px" padding-top="0px" src="cid:image2" width="600px"></mj-image>
</mj-column>
</mj-section>
<mj-section>
<mj-column>
<mj-image align="center" height="auto" padding-bottom="0px" padding-left="0px" padding-right="0px" padding-top="0px" src="https://9pl9.mjt.lu/tplimg/9pl9/b/xujmm/vg5z1.png" width="600px"></mj-image>
</mj-column>
</mj-section>
</mj-body>
</mjml>
Also, I attached a screenshot video. https://user-images.githubusercontent.com/1797699/186596625-863e30ed-643c-46c3-ae53-b6776b4e25c9.mov
The second video is proof that my macOS client is good at rendering other content! https://user-images.githubusercontent.com/1797699/186596669-b2c8dd4e-e7f1-4520-99d2-042f38219c16.mov
I have the same issue still:
https://user-images.githubusercontent.com/1079135/191257425-d571cc69-4e34-4311-aa44-6383a17088d6.mov
We need more info on that to reproduce. Try to send the email on putsmail.com to see if there's anything that could alter the html. Check if you reopen the email with same window height/width it behave the same or if it's only when resizing.
We need more info on that to reproduce. Try to send the email on putsmail.com to see if there's anything that could alter the html.
Litmus doesn't allow me to attach the images (which we do for privacy reasons), so I can only test with image URLs. And that seems to work fine via Litmus:
https://user-images.githubusercontent.com/1079135/191270075-0c6a372a-34c7-40c6-8fe4-b0000b5fc01d.mov
Check if you reopen the email with same window height/width it behave the same or if it's only when resizing.
Yes, it still happens:
There seems to some encoding of the dot in the non-litmus version:
<style type=3D"text/css">
@media only screen and (min-width:480px) {
.mj-column-per-100 { width:100% !important; max-width: 100%; }
-.mj-column-per-34 { width:34% !important; max-width: 34%; }
-.mj-column-per-2 { width:2% !important; max-width: 2%; }
-.mj-column-per-64 { width:64% !important; max-width: 64%; }
-.mj-column-per-50 { width:50% !important; max-width: 50%; }
+=2Emj-column-per-34 { width:34% !important; max-width: 34%; }
+=2Emj-column-per-2 { width:2% !important; max-width: 2%; }
+=2Emj-column-per-64 { width:64% !important; max-width: 64%; }
+=2Emj-column-per-50 { width:50% !important; max-width: 50%; }
}
</style>
=2E
in version with the error (mailgun)
.
in litmus test
And of course the images changed:
<td style=3D"width:140px;">
-<img height=3D"auto" src=3D"https://assets.simpleanalytics.com/newsletter/g=
-eneral/logo-280px.png" style=3D"border:0;border-radius:0;display:block;outl=
-ine:none;text-decoration:none;height:auto;width:100%;font-size:13px;" width=
-=3D"140">
+<img height=3D"auto" src=3D"cid:simple-analytics-logo.png" style=3D"border:=
+0;border-radius:0;display:block;outline:none;text-decoration:none;height:au=
+to;width:100%;font-size:13px;" width=3D"140">
</td>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
So this is an issue with the ESP not MJML. We can't do anything about this, just open a ticket on their side ?
Yes, I believe you are right. Thanks for the tip about Litmus email test. And sorry for stealing your time away.
@chazepps did you use Mailgun as well?
Never mind, you're using AWS SES.
I do wonder if it fixes your problem when using Litmus as well.
Might be because of CID images too. It's weird that the last image on his email works fine, and both cid image behave like that.
@adriaanvanrossum I think I found a way. Put this in the body and test it.
<mj-raw>
<style>img {margin: 0;}</style>
</mj-raw>
@chazepps that indeed resolved my issue! Thanks for sharing.
Might need to add this to our skeleton if it fix the issue for everyone 🎉
Describe the bug Images on macOS Apple Mail go outside of the email body.
Reproduce
mj-column
and the email bodyExpected behavior The images should stay in their "containers" and not get out of
mj-column
.MJML environment (please complete the following information):
Email sending environment(for rendering issues):
Affected email clients (for rendering issues):
Screenshots
✅ Wide (all good)
🟥 Less wide (not good)
.mjml
and.eml
file: issue-2251.zip