Summary:ASTERISK-17182: [patch] Not correct encode Header of mail message
Reporter:Chodorenko Michail (chodorenko)Labels:
Date Opened:2010-12-29 15:11:41.000-0600Date Closed:2012-09-25 08:12:18
Versions:Frequency of
Environment:Attachments:( 0) issue18552.patch
Description:Not correct encode Header of mail message
X-Amavis-Alert: BAD HEADER SECTION, Non-encoded 8-bit data (char D0 hex):
Date: \320\241\321\200\320\264, 29 \320\224\320\265\320[...]



Header from incoming message

Received: by p.domain.com (Postfix, from userid 0)
id 6C89939377; Wed, 29 Dec 2010 22:16:53 +0200 (EET)
Date: ??????, 29 ?”?µ?? 2010 21:16:53 +0100
From: =?UTF-8?Q?=D0=A2=D0=B5=D0=BB=D0=B5=D1=84=D0=BE=D0=BD=D0=BD=D0=B0=D1?=
To: "Chodorenko Michail" <m.Chodorenko@domain.com>
Subject: ***SPAM***
Message-ID: <Asterisk-3-1629248748-4000-4584@p>
X-Asterisk-CallerID: 4000
X-Asterisk-CallerIDName: Chodorenko Michail
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----voicemail_340004584135794168"
Comments:By: Leif Madsen (lmadsen) 2011-01-04 16:12:46.000-0600

To me this looks like it's because app_voicemail isn't UTF-8 compliant? It probably doesn't know how to encode the characters correctly.

By: Chodorenko Michail (chodorenko) 2011-01-04 16:20:54.000-0600

Other fields are coded correctly, in config file present Option for setting locale, obviously the developer did not expect that can be used by other system locale for date display

By: David Woolley (davidw) 2011-01-05 05:11:12.000-0600

The problem is that it has used a localised date when the email RFC doesn't allow one.  This header should never have any non-ASCII characters in it.

Email header dates need to be machine parseable and it is not reasonable for email clients to recognize month names in every language.

The required format is in RFC 2822, section 3.3, and the relevant productions are:

date-time       =       [ day-of-week "," ] date FWS time [CFWS]

day-name        =       "Mon" / "Tue" / "Wed" / "Thu" /
                       "Fri" / "Sat" / "Sun"

date            =       day month year

month-name      =       "Jan" / "Feb" / "Mar" / "Apr" /
                       "May" / "Jun" / "Jul" / "Aug" /
                       "Sep" / "Oct" / "Nov" / "Dec"

By: Chodorenko Michail (chodorenko) 2011-01-05 12:27:49.000-0600

Probably if it makes sense write to header message this field is not localized format, and use the date of the body message in regional settings

By: Sean Bright (seanbright) 2011-01-17 16:33:02.000-0600

Does the uploaded patch fix the problem?

By: Chodorenko Michail (chodorenko) 2011-01-19 07:58:12.000-0600

that I do not understand how the system locale and the format dates. If I set a variable in emaildateformat voicemail.conf might start writing in English, if you do not expose it says in Russian, but sometimes it goes in English and works until the moment until I change variable emaildateformat and reload app_voicemail.so.
Somewhere stored value in what form to display the date??

By: Sean Bright (seanbright) 2011-01-19 08:01:46.000-0600

Sorry, I do not understand what you are asking.

By: Matt Jordan (mjordan) 2012-09-25 08:12:13.785-0500

This issue was fixed in r368520, in which app_voicemail was brought in compliance with RFC 2822.