report a bug |  advanced search |  statistics |  developer log in/out
Bug #68 mlmmj doesn't encode subject prefix
Submitted: 2017-12-29 21:49 UTC Modified: 2018-01-16 13:49 UTC
From: zhb at iredmail dot org Assigned:
Status: Duplicate
Mlmmj Version: 1.3.0.0 OS: CentOS 7
MTA: Postfix MTA Version:
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes. If this is not your bug, you can add a comment by following this link. If this is your bug, but you forgot your password, you can retrieve your password here.
Password:

 

 [2017-12-29 21:49 UTC] zhb at iredmail dot org
Description:
------------
I use a Chinese word as mail subject prefix, but mlmmj doesn't encode it.

For example:

*) in mlmmj, mail subject prefix is set to a Chinese word, e.g. '[中文]'.
*) Compose a message with subject: "Test"
*) Email sent out by mlmmj has this mail header:

```
Subject: <Chinese> Test
```

Another real-world example, compose email with subject "中文" (both mlmmj subject 
prefix and original mail subject are same Chinese word):

```
Subject: [中文] =?UTF-8?Q?=E4=B8=AD=E6=96=87?=
```

Expected result:
----------------
Mlmmj should construct new mail subject with mlmmj subject prefix and original mail 
subject first, then encode it.


Patches

Add a Patch

History

AllCommentsChanges
 [2017-12-29 21:57 UTC] zhb at iredmail dot org
Found a solution: store encoded string in `control/prefix` works.

This must be mentioned in document: http://mlmmj.org/docs/tunables/
 [2017-12-29 22:48 UTC] zhb at iredmail dot org
My solution with python code:

```
>>> from email.header import Header
>>> Header(u'中文', 'utf-8').encode()
'=?utf-8?b?5Lit5paH?='
```

Store '=?utf-8?b?5Lit5paH?=' (without quotes) in 'control/prefix'.
 [2017-12-29 23:27 UTC] zhb at iredmail dot org
Storing encoded subject prefix text doesn't work well:

*) Webmail (Roundcube) correctly displays the mail subject:

<prefix> <original subject>

*) reply the email, received email subject becomes:

<prefix> Re: <prefix> <original subject>

And this goes on and on if you reply it:

<prefix> Re: <prefix> Re: <prefix> <original subject>
<prefix> Re: <prefix> Re: <prefix> Re: <prefix> <original subject>

Same issue if we store raw Chinese words in 'control/prefix', but no issue with English 
words.

It's more like a mlmmj bug while handling non-ascii subject prefix.
 [2018-01-16 13:49 UTC] maintainer at mlmmj dot org
This is a duplicate of #16, or closely enough related that they should be solved together.
 [2018-01-16 17:12 UTC] zhb at iredmail dot org
Yes this issue is duplicate of #16. (i didn't see it, sorry about this.)

IMO, mlmmj should:

1. decode original subject first
2. combine (raw) subject prefix and decoded subject
3. encode combined subject in UTF-8.

Your thought?
 
Based on the PHP bug tracker.
Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Jan 30 01:27:44 2013 UTC