flask-mail icon indicating copy to clipboard operation
flask-mail copied to clipboard

Subject encoding error with Python3.4

Open harobed opened this issue 11 years ago • 6 comments

This line https://github.com/mattupstate/flask-mail/blob/master/flask_mail.py#L385 don't work with Python3.4

With :

           return self._message().as_string().encode(self.charset or 'utf-8')

Subject encoding work with success.

With :

            return self._message().as_bytes()

Subject encoding fail.

I suggest to always use :

           return self._message().as_string().encode(self.charset or 'utf-8')

harobed avatar Oct 16 '14 22:10 harobed

which python are you 3.4.2?

jamesonjlee avatar Oct 18 '14 04:10 jamesonjlee

https://github.com/mattupstate/flask-mail/pull/85 that's why that patch was accepted, can you created a counter-test?

jamesonjlee avatar Oct 18 '14 04:10 jamesonjlee

Yes, 3.4.2

harobed avatar Oct 20 '14 07:10 harobed

@jamesonjlee Ok, I've appended one test for this bug. Without my patch, this new test fail with python 3.4

harobed avatar Oct 20 '14 13:10 harobed

@harobed thanks for following up (and sorry for late follow up), can you make sure you retain the as_string() portion of the test as well as adding the as_byte()? other than that, looks good to merge.

jamesonjlee avatar Oct 29 '14 18:10 jamesonjlee

bump

harobed avatar Jun 21 '15 16:06 harobed

If email.Message.as_bytes() is failing on something it shouldn't, that seems to be an issue to report to Python's smtplib. 3.8 is the lowest supported version in 2024, and it does not appear to have an issue.

davidism avatar May 23 '24 16:05 davidism