Opened 16 years ago
Closed 15 years ago
#8252 closed enhancement (fixed)
Allow 8bit emails from trac
Reported by: | Owned by: | Remy Blank | |
---|---|---|---|
Priority: | normal | Milestone: | 0.11.5 |
Component: | general | Version: | none |
Severity: | normal | Keywords: | |
Cc: | petr.hroudny@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
#1754 introduced new config option
[notification] mime_encoding = base64 | qp | none
in order to avoid unnecessary base64 encoding in emails from trac. However, it's still not possible to have trac output plain 8bit emails, since "none" only works with pure ASCII.
It's perfectly valid to generate 8-bit UTF-8 emails today, when the following MIME headers are used:
Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit
An example MUAs doing that are Thunderbird, Mutt, …
Thus another option for 8bit notifications is needed and I'd even say it should be the default these days.
The following addition into /trunk/trac/notification.py should do it:
297 elif pref == '8bit': 298 self._charset.header_encoding = SHORTEST 299 self._charset.body_encoding = None 300 self._charset.output_charset = 'utf-8' 301 self._charset.input_codec = 'utf-8' 302 self._charset.output_codec = 'utf-8'
Attachments (1)
Change History (5)
comment:1 by , 16 years ago
Milestone: | → 0.11.5 |
---|---|
Owner: | set to |
follow-up: 3 comment:2 by , 16 years ago
by , 16 years ago
Attachment: | 8252-8bit-body-encoding-r8165.patch added |
---|
Patch against 0.11-stable using either 7bit or 8bit body encoding when mime_encoding = none
.
comment:3 by , 16 years ago
Replying to petr.hroudny@…:
Thus is might be perhaps better to redefine what "none" does in Trac and sync it with Python.
This makes a lot of sense to me. Throwing an error when an e-mail requires 8bit encoding (which is quite often, as the ellipsis is used to obfuscate e-mail addresses) and [notification] mime_encoding = none
is not very user friendly.
The patch above implements the suggestion, together with a test case.
Manu, could you please comment on the patch? Thanks!
There is actually a major difference between Trac and Python. Option "none" in Python means no special encoding should be used and 8bit body is allowed, while in Trac this option only allows 7-bit ASCII messages.
Thus is might be perhaps better to redefine what "none" does in Trac and sync it with Python. The following lines need to be changed:
And the following lines need to be removed:
After the above changes, the option "none" could be used to send out properly formatted 8bit utf-8 emails.