Modify

Opened 12 years ago

Closed 12 years ago

#259 closed defect (invalid)

Help getting Email2Trac to send HTML emails.

Reported by: kofal002@… Owned by: bas
Priority: major Milestone:
Component: email2trac Version: 2.1.0
Keywords: Cc:

Description

I have performed a slight modification to Trac's source to send HTML notification emails. Really, I just added this line:

headers['Content-Type'] = 'text/html; charset=utf-8'

to NotifyEmail's send() function in trac\notification.py and it works fine. Whenever I respond to a ticket via Trac's webUI, Trac's notification email is sent using my custom templates\ticket_notify_email.txt, and the content-type is correctly flagged as HTML.

It would appear that Email2Trac uses the same code paths to send email:

def notify(self, tkt, new=True, modtime=0):
...
    tn = TicketNotifyEmail(self.env)
...
    tn.notify(tkt, new, modtime)

However, despite my best efforts to figure out why, Email2Trac-triggered emails are sent text/plain content-type. This is bad, since it's using the same custom (HTML) email template, but sending as raw text, and the HTML will not render. I've been digging through the code in both Email2Trac and in Trac's source, and I cannot find why this is the case.

This may not be in Email2Trac's main feature set, but I was hoping you could lend some insight on how to do this.

Attachments (0)

Change History (2)

comment:1 Changed 12 years ago by kofal002@…

Looking at the raw email headers of the emails that do get sent as HTML (the ones sent via Trac's web UI), it looks like the content-type is getting set twice:

Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
X-Trac-Version: 0.12.2
...
Content-Type: text/html; charset=utf-8

However, I can't find the code that sets the original "text/plain" header.

comment:2 Changed 12 years ago by kofal002@…

  • Resolution set to invalid
  • Status changed from new to closed

Crud! I was using two different python installations and forgot to modify them both!

Email2Trac wasn't to blame at all; my fault entirely :)

Add Comment

Modify Ticket

Change Properties
Action
as closed The owner will remain bas.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.