Modify

Opened 9 months ago

Last modified 8 months ago

#11642 accepted enhancement

Feature Request to Embed Attachments into the HTML Notifications

Reported by: jamuel@… Owned by: jun66j5
Priority: normal Component: TracHtmlNotificationPlugin
Severity: normal Keywords:
Cc: Trac Release:

Description

We really enjoy the HTML ticket notification emails. We wyould however prefer to have the ticket's attachments that are images (e.g. jpeg, gif, png) included as mime attachments embedded in the message so that mail clients can directly render them. This would go a long way to help the email recipients visualize those tickets that include screenshots without forcing them to "click-thru" the email just to see the screenshots.

Not sure if you work for bounties but we could potentially sponsor this effort--please feel free to contact us directly if you wish.

Thanks for listening!

Cheers,

JPS

Attachments (1)

t11642-embed-images-in-notification.diff (3.6 KB) - added by jun66j5 9 months ago.

Download all attachments as: .zip

Change History (7)

Changed 9 months ago by jun66j5

comment:1 Changed 9 months ago by jun66j5

  • Status changed from new to accepted

comment:2 follow-up: Changed 9 months ago by jamuel@…

Thank you for accepting this feature request.

With the patch you've provided I can confirm that a new MIME attachment is included. It would appear, however, that all MIME parts of the message are base64 encoded.

At this point when viewing a message in Apple Mail all I see is the embedded (image) attachment and not any of the regular HTML text. Viewing the same message in Horde IMP (webmail) and Squirrelmail no viewable text is shown without having to click through the various attachments to force them to display the HTML.

Also it would appear that you are only sending the new attachment and not any previous attachments .

In any case for an HTML email message I would normally expect the Content-type: text/plain portion (for non-html views) to NOT be base64 encoded but rather quoted-printable. Similarly for the Content-type: text/html leaving only the images as base64 encoded.

Also I would then expect that all attachments be included in the email as opposed to just the most recent attachment.

Hope that helps!

comment:3 Changed 9 months ago by anonymous

I also notice that for the embedded images that the Content-type header for the MIME part attachment is always set to image/unknown. Not knowing much about python I wonder if you can call imghdr.what() and then set the Content-type accordingly?

https://docs.python.org/2/library/imghdr.html

comment:4 in reply to: ↑ 2 ; follow-up: Changed 9 months ago by jun66j5

I revised the patch. See https://github.com/jun66j5/trachtmlnotificationplugin/compare/t11642 (unified-diff). I've confirmed that embed images are shown on Gmail and Thunderbird.

In any case for an HTML email message I would normally expect the Content-type: text/plain portion (for non-html views) to NOT be base64 encoded but rather quoted-printable. Similarly for the Content-type: text/html leaving only the images as base64 encoded.

That's depended on your [notification] mime_encoding settings.

Also I would then expect that all attachments be included in the email as opposed to just the most recent attachment.

I wouldn't like to attach all files. I think that behaviour is so waste.

Last edited 9 months ago by jun66j5 (previous) (diff)

comment:5 in reply to: ↑ 4 Changed 9 months ago by Jamuel Starkey <jamuel@…>

Replying to jun66j5:

I revised the patch. [snip] I've confirmed that embed images are shown on Gmail and Thunderbird.

I'm okay with your latest patch--it works great! I've confirmed Apple Mail displays the original ticket including any images in the ticket. And Horde IMP displays the ticket when you click on the Parts > Related link that IMP provides.

The patch works perfectly in Apple Mail (OS X Mavericks). I can confirm that the original ticket body along with any in-line images contained therein display just fine.

In any case for an HTML email message I would normally expect the Content-type: text/plain portion (for non-html views) to NOT be base64 encoded but rather quoted-printable. Similarly for the Content-type: text/html leaving only the images as base64 encoded.

That's depended on your [notification] mime_encoding settings.

Just changed mine to quoted-printable and it works just as you suggest (the text and the html are QP while the images are base64 encoded).

Also I would then expect that all attachments be included in the email as opposed to just the most recent attachment.

I wouldn't like to attach all files. I think that behaviour is so waste.

Actually you are correct. I was originally thinking that you would only include the current ticket update's attachment(s) and not any in-line images that are part of the ticket body.

I can confirm that the in-line images that are contained in the ticket body are always sent with the notification which is what I'd expect and what I was originally hoping for when I made the request.

Thank you so much for completing this enhancement I consider it feature complete.

comment:6 Changed 8 months ago by ashish.khanna@…

thanks

Add Comment

Modify Ticket

Action
as accepted The owner will remain jun66j5.
Author


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

 
Note: See TracTickets for help on using tickets.