MAIL FROM: contains messy characters
Hello,
I noticed weird behavior of mutt when I have set UTF8 locales. Sometimes the sent e-mail is rejected by receiving side with error:
2024-03-08T16:30:21.168648+01:00 b postfix/smtp[1112162]: 74ABB8832AE: to=<test@domain.cz>, relay=mx1.domain.cz[2a02:::]:25, delay=2.7, delays=0.06/0.02/2.6/0.04, dsn=4.7.0, status=deferred (host mx1.domain.cz[2a02:::] said: 451 4.7.0 temporary delivery problem (in reply to MAIL FROM command))
The error message is exactly correct, because:
2024-03-08T16:30:18.533464+01:00 b postfix/qmgr[875630]: 74ABB8832AE: from=<"???BCNV"@mymail.cz>, size=4536, nrcpt=1 (queue active)
And in .muttdebug file I can read this:
[2024-03-08 17:22:22] Reading configuration file '/home/user/.mutt/account/mymail.cz'.
[2024-03-08 17:22:22] Vyhledává se mail.mymail.cz…
[2024-03-08 17:22:22] Připojuje se k mail.mymail.cz…
[2024-03-08 17:22:22] SSL/TLS spojení pomocí TLS1.3 (ECDHE-RSA/AES-256-GCM/AEAD)
[2024-03-08 17:22:23] Connected to mail.mymail.cz:465 on fd=5
[2024-03-08 17:22:23] 5< 220 mymail.cz ESMTP Postfix
[2024-03-08 17:22:23] 5> EHLO localpc.lan^M
[2024-03-08 17:22:23] 5< 250-mymail.cz
[2024-03-08 17:22:23] 5< 250-PIPELINING
[2024-03-08 17:22:23] 5< 250-SIZE 40960000
[2024-03-08 17:22:23] 5< 250-ETRN
[2024-03-08 17:22:23] 5< 250-AUTH LOGIN PLAIN
[2024-03-08 17:22:23] 5< 250-AUTH=LOGIN PLAIN
[2024-03-08 17:22:23] 5< 250-ENHANCEDSTATUSCODES
[2024-03-08 17:22:23] 5< 250-8BITMIME
[2024-03-08 17:22:23] 5< 250-DSN
[2024-03-08 17:22:23] 5< 250-SMTPUTF8
[2024-03-08 17:22:23] 5< 250 CHUNKING
[2024-03-08 17:22:23] smtp_auth_gsasl: using mech PLAIN
[2024-03-08 17:22:23] Přihlašuje se (PLAIN)…
[2024-03-08 17:22:23] 5> AUTH PLAIN ...^M
[2024-03-08 17:22:23] 5< 235 2.7.0 Authentication successful
[2024-03-08 17:22:23] 5> MAIL FROM:<^D^S^BCNV> BODY=8BITMIME^M <<<==== HERE IS SENT MAIL FROM:
[2024-03-08 17:22:23] 5< 250 2.1.0 Ok
[2024-03-08 17:22:23] 5> RCPT TO:<test@domain.cz>^M
[2024-03-08 17:22:23] 5< 250 2.1.5 Ok
[2024-03-08 17:22:23] updating progress: 0K
[2024-03-08 17:22:23] Posílám zprávu… 0K/1,2K (0%)
[2024-03-08 17:22:23] 5> DATA^M
[2024-03-08 17:22:23] 5< 354 End data with <CR><LF>.<CR><LF>
[2024-03-08 17:22:23] 5> Date: Fri, 8 Mar 2024 17:22:22 +0100^M
[2024-03-08 17:22:23] 5> From: Michal Heppler <mhepp_20a83b42@mymail.cz>^M
...
From
in e-mail is properly set to mhepp_20a83b42@mymail.cz
- no UTF-8 chars etc.
And when unset LC_ALL
, LANG
, etc... Simply, no locales/localization, but From
is identical:
postfix logs, message is queued:
2024-03-08T17:38:54.992821+01:00 b postfix/qmgr[875630]: E56A688349B: from=<1.2.840.113549.1.1.1@mymail.cz>, size=3108, nrcpt=1 (queue active)
and .muttdebug
:
...
[2024-03-08 17:38:53] smtp_auth_gsasl: using mech PLAIN
[2024-03-08 17:38:53] Authenticating (PLAIN)...
[2024-03-08 17:38:53] 5> AUTH PLAIN ...^M
[2024-03-08 17:38:53] 5< 235 2.7.0 Authentication successful
[2024-03-08 17:38:53] 5> MAIL FROM:<1.2.840.113549.1.1.1> BODY=8BITMIME^M
[2024-03-08 17:38:53] 5< 250 2.1.0 Ok
[2024-03-08 17:38:53] 5> RCPT TO:<test@domain.cz>^M
[2024-03-08 17:38:53] 5< 250 2.1.5 Ok
[2024-03-08 17:38:53] updating progress: 0K
[2024-03-08 17:38:53] Sending message... 0K/1.5K (0%)
[2024-03-08 17:38:53] 5> DATA^M
[2024-03-08 17:38:54] 5< 354 End data with <CR><LF>.<CR><LF>
[2024-03-08 17:38:54] 5> Date: Fri, 8 Mar 2024 17:38:52 +0100^M
[2024-03-08 17:38:54] 5> From: Michal Heppler <mhepp_20a83b42@mymail.cz>^M
...
The error message of receiver is sometimes:
500 5.5.2 Error: bad UTF-8 syntax
I added some debug messages to related part of code:
if (EnvFrom)
envfrom = EnvFrom->mailbox;
dprint(1,(debugfile,"EnvFrom set, EnvFrom->mailbox='%s', envfrom='%s'\n", EnvFrom->mailbox, envfrom));
else if (from)
envfrom = from->mailbox;
dprint(1,(debugfile,"EnvFrom NOT set, using from: from->mailbox='%s', envfrom='%s'\n", from->mailbox, envfrom));
else
{
mutt_error (_("No from address given"));
return -1;
}
dprint(1,(debugfile,"EnvFrom debug value of envfrom='%s'\n", envfrom));
And here is a result:
[2024-03-08 18:26:31] EnvFrom set, EnvFrom->mailbox='mhepp@mymail.cz', envfrom='mhepp@mymail.cz'
[2024-03-08 18:26:31] EnvFrom debug value of envfrom='mhepp@mymail.cz'
[2024-03-08 18:26:31] Reading configuration file '/home/user/.mutt/account/mymail.cz'.
[2024-03-08 18:26:31] Vyhledává se mail.mymail.cz…
[2024-03-08 18:26:31] Připojuje se k mail.mymail.cz…
[2024-03-08 18:26:31] SSL/TLS spojení pomocí TLS1.3 (ECDHE-RSA/AES-256-GCM/AEAD)
[2024-03-08 18:26:32] Connected to mail.mymail.cz:465 on fd=5
[2024-03-08 18:26:32] 5< 220 mymail.cz ESMTP Postfix
[2024-03-08 18:26:32] 5> EHLO localpc.lan^M
[2024-03-08 18:26:32] 5< 250-mymail.cz
[2024-03-08 18:26:32] 5< 250-PIPELINING
[2024-03-08 18:26:32] 5< 250-SIZE 40960000
[2024-03-08 18:26:32] 5< 250-ETRN
[2024-03-08 18:26:32] 5< 250-AUTH LOGIN PLAIN
[2024-03-08 18:26:32] 5< 250-AUTH=LOGIN PLAIN
[2024-03-08 18:26:32] 5< 250-ENHANCEDSTATUSCODES
[2024-03-08 18:26:32] 5< 250-8BITMIME
[2024-03-08 18:26:32] 5< 250-DSN
[2024-03-08 18:26:32] 5< 250-SMTPUTF8
[2024-03-08 18:26:32] 5< 250 CHUNKING
[2024-03-08 18:26:32] smtp_auth_gsasl: using mech PLAIN
[2024-03-08 18:26:32] Přihlašuje se (PLAIN)…
[2024-03-08 18:26:32] 5> AUTH PLAIN ...^M
[2024-03-08 18:26:32] 5< 235 2.7.0 Authentication successful
[2024-03-08 18:26:32] 5> MAIL FROM:<accv@accv.es> BODY=8BITMIME^M <<<=== WHY IS THERE "accv@accv.es"??? This message is unchanged!!!
[2024-03-08 18:26:32] 5< 250 2.1.0 Ok
[2024-03-08 18:26:32] 5> RCPT TO:<test@domain.cz>^M
...
After few attempts, it seems the value in MAIL FROM:<...>
may varry:
accv@accv.es
- empty value
^F^L^DACCV
^D^S^BCNV
-
^P0^N<81>^Laccv@accv.es
(this was detected as UTF-8 and related record in postfix log isfrom=<"???ACCV"@mymail.cz>
)
and others...
but at all seems random
Edited by mhepp007