Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

Last modified 16 years ago

#1744 closed enhancement (fixed)

MIME encoding of notify mail with non-ascii project name

Reported by: Shun-ichi Goto <gotoh@…> Owned by: Emmanuel Blot
Priority: normal Milestone: 0.10
Component: general Version: devel
Severity: normal Keywords: notification email
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

On creating notify mail, X-Trac-Project: header and From: header use project name. When I use non-ascii project name, mail message will be sent with raw utf-8 bytes value without MIME encoding. This is not good.

First, I've modified like this (but not good):

Index: Notify.py
===================================================================
--- Notify.py	(revision 1875)
+++ Notify.py	(working copy)
@@ -136,10 +136,10 @@
         msg['X-Mailer'] = 'Trac %s, by Edgewall Software' % __version__
         msg['X-Trac-Version'] =  __version__
         projname = self.config.get('project','name')
-        msg['X-Trac-Project'] =  projname
+        msg['X-Trac-Project'] =  Header(projname, 'utf-8')
         msg['X-URL'] =  self.config.get('project','url')
         msg['Subject'] = Header(self.subject, 'utf-8')
-        msg['From'] = '%s <%s>' % (projname, self.from_email)
+        msg['From'] = Header('%s <%s>' % (projname, self.from_email), 'utf-8')
         msg['Sender'] = self.from_email
         msg['Reply-To'] = self.replyto_email
         msg['To'] = rcpt

X-Trac-Project: header seems be good. But From: header, which is structured header (in rfc2822 context), is so bad because entire value would be encoded.

I don't know right way of using email package to handle structured field like From: field. One easy fix to allow non-ascii project name is changing From: value not to use project name.

Index: Notify.py
===================================================================
--- Notify.py	(revision 1875)
+++ Notify.py	(working copy)
@@ -136,10 +136,10 @@
         msg['X-Mailer'] = 'Trac %s, by Edgewall Software' % __version__
         msg['X-Trac-Version'] =  __version__
         projname = self.config.get('project','name')
-        msg['X-Trac-Project'] =  projname
+        msg['X-Trac-Project'] =  Header(projname, 'utf-8')
         msg['X-URL'] =  self.config.get('project','url')
         msg['Subject'] = Header(self.subject, 'utf-8')
-        msg['From'] = '%s <%s>' % (projname, self.from_email)
+        msg['From'] = 'Trac <%s>' % self.from_email
         msg['Sender'] = self.from_email
         msg['Reply-To'] = self.replyto_email
         msg['To'] = rcpt

Attachments (0)

Change History (8)

comment:1 by dserodio@…, 19 years ago

Cc: dserodio@… added

comment:2 by Emmanuel Blot, 19 years ago

Keywords: notification email added
Owner: changed from Jonas Borgström to Emmanuel Blot
Status: newassigned

comment:3 by Emmanuel Blot, 19 years ago

Milestone: 0.10
Resolution: fixed
Status: assignedclosed

Fixed in the new notification implementation available in trunk.

comment:4 by anonymous, 17 years ago

Cc: dserodio@… removed

comment:6 by Remy Blank, 16 years ago

Milestone: 0.10
Version: devel

comment:7 by MargySlarfDaf, 16 years ago

Nice! I think i will use it. Thanks!

comment:8 by mesAllerrymug, 16 years ago

I need a driver for my phillips snn6500 wireless netcard or smc2632 wireless net card. I can`t make them run on linpus linux lite.

Please help.

Regards, atticyIcepemi

in reply to:  8 comment:9 by anonymous, 16 years ago

Replying to mesAllerrymug:

I need a driver for my phillips snn6500 wireless netcard or smc2632 wireless net card. I can`t make them run on linpus linux lite.

And you randomly pick up a server on the web

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Emmanuel Blot.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Emmanuel Blot to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.