# Send mail throws UnicodeEncodeError under python 3.11.9

**URL:** <https://forum.djangoproject.com/t/send-mail-throws-unicodeencodeerror-under-python-3-11-9/29871>\
**Category:** Django Internals\
**Created:** [April 5, 2024, 1:02pm UTC](https://forum.djangoproject.com/t/send-mail-throws-unicodeencodeerror-under-python-3-11-9/29871 "2024-04-05T13:02:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrudelle](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/mrudelle/32/20405_2.png) [@mrudelle](https://forum.djangoproject.com/u/mrudelle)\
**Post date:** [April 5, 2024, 1:02pm UTC](https://forum.djangoproject.com/t/send-mail-throws-unicodeencodeerror-under-python-3-11-9/29871/1 "2024-04-05T13:02:27Z")

</div>

Hi there!

We’re hitting a bug in production with django 4.2.11 and python 3.11.9 due to [recent changes in python](https://github.com/python/cpython/commit/f97f25ef5dfcdfec0d9a359fd970abd139cf3428). I can see [a fix for it on django github](https://github.com/django/django/commit/b231bcd19e57267ce1fc21d42d46f0b65fdcfcf8) which is great.

But I can only see it attached to issue #34900 related to python 3.13, which will be supported by django 5.1. And I am wondering if it will be packed in the next patch release of 4.2 ?

That would be great because for now we stick to 3.11.8 as a workaround but it’s not ideal. Do I need to create a ticket for it to be added in the next patch release?

---

<div class="post-metadata">

**Author:** ![carltongibson](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/carltongibson/32/267_2.png) [@carltongibson](https://forum.djangoproject.com/u/carltongibson)\
**Post date:** [April 5, 2024, 1:35pm UTC](https://forum.djangoproject.com/t/send-mail-throws-unicodeencodeerror-under-python-3-11-9/29871/2 "2024-04-05T13:35:13Z")

</div>

> <https://github.com/python/cpython/pull/116125>
>
> \* Issue: gh-76511

There are related back port issues for both 3.12 and 3.11, so it looks like we would need matching backports here too. //cc @nessita @sarahboyce

---

<div class="post-metadata">

**Author:** ![nessita](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/nessita/32/12194_2.png) [@nessita](https://forum.djangoproject.com/u/nessita)\
**Post date:** [April 8, 2024, 12:15pm UTC](https://forum.djangoproject.com/t/send-mail-throws-unicodeencodeerror-under-python-3-11-9/29871/3 "2024-04-08T12:15:18Z")

</div>

Thank you everyone, Sarah and I are actively looking into this, will update the post with details as we have them.

---

<div class="post-metadata">

**Author:** ![exlame](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/exlame/32/20526_2.png) [@exlame](https://forum.djangoproject.com/u/exlame)\
**Post date:** [April 10, 2024, 3:20pm UTC](https://forum.djangoproject.com/t/send-mail-throws-unicodeencodeerror-under-python-3-11-9/29871/4 "2024-04-10T15:20:33Z")

</div>

Thanks, our pipeline wasn’t working anymore this week dued to the version 3.11.9 with this error. We locked to 3.11.8 and it was solved for now. Thanks!

---

<div class="post-metadata">

**Author:** ![nessita](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/nessita/32/12194_2.png) [@nessita](https://forum.djangoproject.com/u/nessita)\
**Post date:** [April 10, 2024, 3:21pm UTC](https://forum.djangoproject.com/t/send-mail-throws-unicodeencodeerror-under-python-3-11-9/29871/5 "2024-04-10T15:21:44Z")

</div>

An update on this topic:

- Mariusz has updated the Python versions in Jenkins CI so we run the latest and are able to catch issues like this and also tests the fixes.
- We’ll backport revision b231bcd19e57267ce1fc21d42d46f0b65fdcfcf8 to Django 5.0.5 and 4.2.12, with release date set for May 6th.
- We have a PR that that will be merged soon which adds a test, and release notes to be backported to stable branches.

Thank you everyone!
