Page 1 of 1
Mail encoding error when using SMTP over SSL
Posted: Sun May 14, 2017 11:19 pm
by tomeda
Hi,
My mail settings are like this:
SMTP
ssl://mail.example.com
465
user@example.com
password
I'm receiving emails but I see not correct encoding in part of my messages:
https://drive.google.com/file/d/0BzPa5u ... p=drivesdk
I'm using OC 1.5.6.1
Thanks for any information that can point me to fix this issue!
Re: Mail encoding error when using SMTP over SSL
Posted: Tue May 16, 2017 11:31 pm
by ADD Creative
If you view the email source what is the charset set to on the Content-Type: lines of each part on the email?
Re: Mail encoding error when using SMTP over SSL
Posted: Wed May 17, 2017 1:55 am
by tomeda
Re: Mail encoding error when using SMTP over SSL
Posted: Wed May 17, 2017 9:44 pm
by ADD Creative
Have you checked the source of that text? It could be the error is in the language file or database. What characters are meant to be there? It might not show in a web browser and only in an email. Have you tried deleting and retyping that section?
Re: Mail encoding error when using SMTP over SSL
Posted: Thu May 18, 2017 1:20 am
by tomeda
I've checked it many times rewrited it at all, nothing changed. I've even changed that text with a new one the problem still exist. When I go back to mail setting and put mail protocol to "mail" it works just fine when I switch to "SMTP" problem exist.
Re: Mail encoding error when using SMTP over SSL
Posted: Fri May 19, 2017 12:36 am
by ADD Creative
I have sort of manage to recreate the problem by having a line in the email over 998 bytes in length. Note it's bytes in length not characters.
The problem seems to be that when sending the email via SMTP the lines are split into 998 byte chunks using str_split.
https://github.com/opencart/opencart/bl ... l.php#L356
str_split is not UTF-8 safe so could cut the line in the middle of a UTF-8 character byte sequence, causing the error.
A way around it may be to ensure that no lines are over 998 bytes long by adding line breaks ("\n") to the source of the text or simplifying the HTML content.