From ee3d3e8c249d051ee9c87b10dc6de96f2d90e6f0 Mon Sep 17 00:00:00 2001 From: anor Date: Fri, 27 Mar 2026 16:07:29 +1000 Subject: [PATCH] =?UTF-8?q?fix:=20Mail.ru=20SMTP=20=E2=80=94=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=B4=D0=B8=D1=80=D0=BE=D0=B2=D0=BA=D0=B0=20=D0=BA=D0=B8?= =?UTF-8?q?=D1=80=D0=B8=D0=BB=D0=BB=D0=B8=D1=86=D1=8B=20=D0=B2=20From=20he?= =?UTF-8?q?ader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mail.ru отклоняет raw кириллицу в headers (550 invalid headers). Используем email.header.Header для RFC 2047 encoding. Co-Authored-By: Claude Opus 4.6 (1M context) --- email_service.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/email_service.py b/email_service.py index 44cdbff..f357de4 100644 --- a/email_service.py +++ b/email_service.py @@ -36,7 +36,8 @@ def send_verification_code(to_email: str, code: str) -> bool: msg = MIMEMultipart("alternative") msg["Subject"] = subject - msg["From"] = f"Сметный ассистент <{SMTP_USER}>" + from email.header import Header + msg["From"] = f"{Header('Сметный ассистент', 'utf-8').encode()} <{SMTP_USER}>" msg["To"] = to_email msg.attach(MIMEText(f"Ваш код подтверждения: {code}\nДействителен 10 минут.", "plain", "utf-8")) msg.attach(MIMEText(html, "html", "utf-8"))