Closed milibopp closed 4 years ago
@aepsil0n Could you check if #1485 fixes your issue?
Thanks for the heads-up. I just checked the issue with the current master (8e96d504) and can confirm that it fixes my issue.
Wait: what? This supposed fix is not yet part of the master branch..
There are two commits (5855e100 and 3ea84785) by @stregouet on master. You merged them in #1485. That is why I simply pulled in the recent master branch to check. Were you not referring to these commits?
sorry, you are right. These are part of the master branch already. Thanks for confirming the fix!
No worries. Glad I could help with testing.
Describe the bug When sending emails using alot that include non-ASCII characters to a SMTP server that does not support UTF-8 in mail headers, the email is bounced by the server. Likely due to a bug in Python, see issue 40157
Software Versions
To Reproduce
Error Log What I get from the SMTP server:
550 Subject contains invalid characters. (in reply to end of DATA command)
The bounced message looks like this (somewhat redacted for privacy reasons):
The important aspect is
Subject: Test üäö
. This has not been encoded. I have traced this down through the source code to alot/commands/envelope.py:245.It was a bit strange to see this behaviour given the existence of
email.policy.SMTPUTF8
. But apparently they both encode headers the same way. I have the impression that this is a bug in the Python standard library, so I also opened issue 40157 on the Python bug tracker.As a workaround, removing the policy parameter and thereby falling back to the default compat32 policy, fixes the problem for me. Does that have any unintended side-effects?