Modify

Opened 11 years ago

Closed 7 years ago

#11176 closed defect (wontfix)

Cannot sent emails on changes to tickets

Reported by: andyhodgsononline@… Owned by:
Priority: normal Component: AnnouncerPlugin
Severity: normal Keywords:
Cc: Trac Release:

Description

I have several Trac installations with (what I think are) identical setups that use TracAnnouncer 1-0dev plugin for notifications.

My standard Trac installations all work as expected for email distribution, but the Trac instance that has Agilo installed (http://www.agilosoftware.com/) only sends email when a ticket is first created, and fails to send email notifications on subsequent changes to the ticket.

This is the debug log from Trac when the system tries to send an email in response to an update to a ticket...

2013-06-19 12:57:46,207 Trac[api] DEBUG: Adding (user1 [1]) for 'always' on rule (TicketOwnerSubscriber) for (email)
2013-06-19 12:57:46,207 Trac[api] DEBUG: Adding (user2 [1]) for 'always' on rule (TicketReporterSubscriber) for (email)
2013-06-19 12:57:46,207 Trac[api] DEBUG: Adding (somebody [1]) for 'always' on rule (TicketComponentOwnerSubscriber) for (email)
2013-06-19 12:57:46,208 Trac[filters] DEBUG: Checking *_VIEW permission on event for resource ticket:88
2013-06-19 12:57:46,209 Trac[filters] DEBUG: Checking *_VIEW permission on event for resource ticket:88
2013-06-19 12:57:46,209 Trac[filters] DEBUG: Checking *_VIEW permission on event for resource ticket:88
2013-06-19 12:57:46,210 Trac[api] DEBUG: AnnouncementSystem has found the following subscriptions: [user1(authenticated) via email], user2(authenticated) via email], [somebody(authenticated) via email]
2013-06-19 12:57:46,210 Trac[mail] DEBUG: EmailDistributor has found the following formats capable of handling 'email' of 'ticket': text/html, text/plain
2013-06-19 12:57:46,212 Trac[mail] DEBUG: EmailDistributor was unable to find an address for: somebody (authenticated)
2013-06-19 12:57:46,213 Trac[mail] DEBUG: EmailDistributor found the address 'user1@domain.com' for 'user1 (authenticated)' via: SessionEmailResolver
2013-06-19 12:57:46,213 Trac[mail] DEBUG: EmailDistributor expected local delivery for user1 to: user1@domain.com
2013-06-19 12:57:46,214 Trac[mail] DEBUG: EmailDistributor found the address 'user2@domain.com' for 'user2 (authenticated)' via: SessionEmailResolver
2013-06-19 12:57:46,214 Trac[mail] DEBUG: EmailDistributor expected local delivery for user2 to: user2@domain.com
2013-06-19 12:57:46,214 Trac[mail] DEBUG: EmailDistributor is sending event as 'text/html' to: user2@domain.com, user1@domain.com
2013-06-19 12:57:46,214 Trac[mail] DEBUG: All email recipients: [u'user2@domain.com', u'user1@domain.com']
2013-06-19 12:57:46,254 Trac[email_decorators] DEBUG: StaticEmailDecorator added 'user3@domain.com' because of rule: email_always_cc
2013-06-19 12:57:46,257 Trac[api] ERROR: AnnouncementSystem failed.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/TracAnnouncer-1.0dev-py2.7.egg/announcer/api.py", line 584, in _real_send
    evt)
  File "/usr/local/lib/python2.7/dist-packages/TracAnnouncer-1.0dev-py2.7.egg/announcer/distributors/mail.py", line 330, in distribute
    self._do_send(transport, event, k, v, fmtdict[k])
  File "/usr/local/lib/python2.7/dist-packages/TracAnnouncer-1.0dev-py2.7.egg/announcer/distributors/mail.py", line 501, in _do_send
    package = (from_header, recip_adds, rootMessage.as_string())
  File "/usr/lib/python2.7/email/message.py", line 137, in as_string
    g.flatten(self, unixfrom=unixfrom)
  File "/usr/lib/python2.7/email/generator.py", line 83, in flatten
    self._write(msg)
  File "/usr/lib/python2.7/email/generator.py", line 115, in _write
    self._write_headers(msg)
  File "/usr/lib/python2.7/email/generator.py", line 148, in _write_headers
    print >> self._fp, v.encode()
  File "/usr/lib/python2.7/email/header.py", line 407, in encode
    newchunks += self._split(s, charset, targetlen, splitchars)
  File "/usr/lib/python2.7/email/header.py", line 292, in _split
    elen = charset.encoded_header_len(encoded)
  File "/usr/lib/python2.7/email/charset.py", line 345, in encoded_header_len
    return len(s)
TypeError: object of type 'int' has no len()
2013-06-19 12:57:46,259 Trac[api] DEBUG: AnnouncementSystem sent event in 0.06 seconds.

The issue appears to be that message.py cannot convert the message object to a string representation.

Is this an issue with AnnouncerPlugin?

Thanks Andy

Attachments (0)

Change History (4)

comment:1 in reply to:  description Changed 11 years ago by Steffen Hoffmann

Replying to andyhodgsononline@…: ...

The issue appears to be that message.py cannot convert the message object to a string representation.

Precisely a part of the headers, yes.

Is this an issue with AnnouncerPlugin?

The plugin might pass some integer value that should be string. OTOH, the MIMEMultipart object from email.MIMEMultipart must have accepted that offending value before (), so I'd rather tend towards assuming it is a bit lame in sanitizing input, handling processing errors, or both.

Still we might improve within plugin's code, i.e. altering 'set_header()' from announcer.util.mail, that in turn uses Header from email.header. Honestly, I'm not an expert in email constructing by now, but at first glance the way this plugin works doesn't look wrong. Quite the contrary, as relying on Python core functionality should rather ensure better code performance.

comment:2 in reply to:  description Changed 11 years ago by Steffen Hoffmann

Replying to andyhodgsononline@…: ...

Is this an issue with AnnouncerPlugin?

Hm, aren't you already asserting this by creating a 'defect' ticket here? Honestly, as long as you're unsure, better discuss on our mailing-list first.

comment:3 Changed 7 years ago by Ryan J Ollos

Owner: Steffen Hoffmann deleted

comment:4 Changed 7 years ago by Ryan J Ollos

Resolution: wontfix
Status: newclosed

Please upgrade to Trac 1.2, which has integrated the core of AnnouncerPlugin. Please raise the issue on the trac:MailingList if you encounter the issue with Trac 1.2.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.