Giter Site home page Giter Site logo

Comments (11)

swrobel avatar swrobel commented on July 22, 2024

@fphilipe any thoughts on this? I'm seeing GMail show "[Message clipped]" despite my emails being well under the 102kb limit, I believe because they contain the © symbol (which is © in my code, but seems to get transformed to © by premailer)

from premailer-rails.

fphilipe avatar fphilipe commented on July 22, 2024

@engwan, @swrobel, sorry for not getting back earlier. I've looked into this. Thanks for the suggestion, @engwan. I've opened a PR and tested the output of different encodings in different mail clients.

Would you mind taking this for a spin? #248

Let me know if you need a beta release.

from premailer-rails.

swrobel avatar swrobel commented on July 22, 2024

@fphilipe I removed the Premailer::Rails.config[:output_encoding] = 'US-ASCII' initializer & used the gem as follows: gem 'premailer-rails', github: 'fphilipe/premailer-rails', branch: 'fix-encoding'

The message clipping is unfortunately back with this branch. It seems this fix doesn't work 😞

from premailer-rails.

fphilipe avatar fphilipe commented on July 22, 2024

Would you be able to share the resulting email as an eml file?

from premailer-rails.

fphilipe avatar fphilipe commented on July 22, 2024

Even better would be if you could also share an eml file generated with the latest release for comparison.

from premailer-rails.

swrobel avatar swrobel commented on July 22, 2024

I emailed you eml files. The key difference seems to be:

clipped: =A9 2019
not clipped: © 2019

Also, clipped emails now have =0D before every newline character

from premailer-rails.

fphilipe avatar fphilipe commented on July 22, 2024

Thanks, @swrobel!

Just to clarify:

  • clipped: no output_encoding specified and using the fix-encoding
  • not clipped: output_encoding set to US-ASCII and using latest available version of the gem from RubyGems

First, both emails render correctly for me in Mail.app and in Thunderbird. Switching to plain text in Thunderbird also renders everything correctly.

The difference between the way © is encoded is because of the removal of output_encoding. When output_encoding is set to US-ASCII premailer (or nokogiri, not sure) will convert non-ascii characters to the equivalent html entity. If you were to keep output_encoding: 'US-ASCII' you'd still get ©.

On the other hand, =A9 is the encoding for the unicode character © (this is the case when Content-Transfer-Encoding is set to quoted-printable; here's a good explanation of the different transfer encodings). I'm unsure though why it is being encoded as =A9 and not =C2=A9 as is the case in the GitHub notification I received for your comment that included that character:

Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: quoted-printable

@fphilipe any thoughts on this? I'm seeing GMail show "[Message clipped]"=
 despite my emails being well under the 102kb limit, I believe because th=
ey contain the =C2=A9 symbol (which is `©` in my code, but seems to =
get transformed to =C2=A9 by premailer)=0D
=0D
-- =0D
You are receiving this because you were mentioned.=0D
Reply to this email directly or view it on GitHub:=0D
https://github.com/fphilipe/premailer-rails/issues/240#issuecomment-53142=
4966=

Regarding =0D, that's simply the encoding of a carriage return. Look at the GitHub notification email above and you'll spot those as well. These get encoded because the non-encoded carriage return has a special meaning in the encoded email. The above gets rendered as follows:

@fphilipe any thoughts on this? I'm seeing GMail show "[Message clipped]" despite my emails being well under the 102kb limit, I believe because they contain the © symbol (which is `©` in my code, but seems to get transformed to © by premailer)

-- 
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
https://github.com/fphilipe/premailer-rails/issues/240#issuecomment-531424966

Questions:

  • If you leave out the © character, does that make any difference in Gmail's clipping?
  • Both emails you shared contain a blob at the end, which I couldn't read or figure out what it is. Can you explain? That's also adding to your emails size.
  • Would you be able to share the email before premailer is run by disabling premailer? That would help in clarifying some of the charset, which look off to me. I'm curious why the email body is encoded as ISO-8859-1 rather than UTF-8.

from premailer-rails.

swrobel avatar swrobel commented on July 22, 2024

@fphilipe apologies for the delay in responding but this took a lot of troubleshooting. The key thing that you noticed was:

I'm curious why the email body is encoded as ISO-8859-1 rather than UTF-8

I looked at the original message being sent by Rails and it indeed should've been UTF-8 so either GMail or Sendgrid was changing it. After changing from Sendgrid to Mailgun, the emails stopped being clipped and GMail's raw view showed the correct UTF-8 encoding (this is just using the currently released gem & no US-ASCII override). Bizarre!!!

Hopefully @engwan can weigh in on whether your branch fixes his issue.

from premailer-rails.

braindeaf avatar braindeaf commented on July 22, 2024

Is there any update on this?

from premailer-rails.

dlouzan avatar dlouzan commented on July 22, 2024

Hey guys, we recently activated SMIME signing for emails within gitlab, and noticed that as soon as any unicode character is included in the email, the calculated signature failed. This pointed to encoding/conversion issues between signature calculation and delivery, and since premailer-rails is also active there, I was suspecting it could be the cause.

But I did some local tests and disabling premailer didn't show any effect. Funny thing, just downgrading the mail gem to 2.6.6 solved the problems. This open issue might be the cause: mikel/mail#1190

We'll be opening an issue in gitlab later but wanted to give you a heads up in case this could be related.

from premailer-rails.

fphilipe avatar fphilipe commented on July 22, 2024

premailer-rails 1.11.0 is out, which should address this. Thanks everyone!

from premailer-rails.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.