Skip to content
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

Should enmime detect HTML format and convert to text in this case? #258

Open
iredmail opened this issue Jul 18, 2022 · 2 comments
Open

Should enmime detect HTML format and convert to text in this case? #258

iredmail opened this issue Jul 18, 2022 · 2 comments

Comments

@iredmail
Copy link
Contributor

iredmail commented Jul 18, 2022

Dear all,

I recently got an email in such format, main content-type is multipart/mixed, one of the part in body is text/plain with Content-Transfer-Encoding: quoted-printable, it contains HTML code and base64 encoded image. enmime doesn't convert html to text, and the encoded image is included in result too.

Question: should enmime detect HTML format and convert it to text in such case?

MIME-Version: 1.0
... [omit other normal email headers here] ...
Content-Type: multipart/mixed; 
	boundary="----=_Part_148993_809028477.1658014818211"

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

<div style=3D"caret-color: rgba(0, 0, 0, 0.847); color: rg=
ba(0, 0, 0, 0.847); font-size: 12px;"><img src=3D"data:image/jpeg;base64,/9=
j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAA=
... [omit long base64 lines] ...
...>...```

@jhillyerd
Copy link
Owner

Currently enmime trusts the Content-Type when it comes to text/plain vs text/html, so this is working as expected. I'm not necessarily opposed to trying to detect and fix the content type, although it should be guarded behind an option. I suspect spammers/phishers may try to bypass filters with this method, so it could pose some danger to the end user.

@iredmail
Copy link
Contributor Author

hi @jhillyerd

Thanks for the reply.

Since email is too easy to forge, it might be reasonable to do some more work beyond RFC as a mail "client" library. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants