Opened 4 years ago

# Feature Request to Embed Attachments into the HTML Notifications

Reported by: Owned by: jamuel@… Jun Omae normal TracHtmlNotificationPlugin normal

### 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

### comment:1 Changed 4 years ago by Jun Omae

Status: new → accepted

### comment:2 follow-up:  4 Changed 4 years 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 4 years 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?

### comment:4 in reply to:  2 ; follow-up:  5 Changed 4 years ago by Jun Omae

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 4 years ago by Jun Omae (previous) (diff)

### comment:5 in reply to:  4 Changed 4 years ago by Jamuel Starkey <jamuel@…>

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.

thanks

### comment:7 Changed 2 years ago by garrett

Hi There,

If an image is included in a comment using [[Image()]] it looks like the HTML email uses the relative path so the image is broken. Is it possible to use the full path for the html emails?

-Garrett

### comment:8 Changed 2 years ago by anonymous

That patch works only for attached image files. If url in <img src="..." /> is relative, the given argument to [[Image()]] macro is not a attachment.

### comment:9 Changed 8 weeks ago by anonymous

This patch doesn't seem to work with the latest version for trac 1.2.2

### Modify Ticket

Change Properties