Closed Bug 660691 Opened 13 years ago Closed 13 years ago

Allow Bugzilla to parse HTML-only inbound email

Categories

(Bugzilla :: Incoming Email, enhancement)

4.1.2
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.4

People

(Reporter: mkanat, Assigned: mkanat)

References

Details

Attachments

(1 file, 1 obsolete file)

Some people send email with only HTML in it. We should make email_in.pl able to parse and accept this email, by turning it into text.
Attached patch v1 (obsolete) — Splinter Review
I'm using HTML::FormatText::WithLinks. I've only done a bit of testing, but I'm going to go work on another patch and wanted to post this one since it was basically done.

HTML::FormatText::WithLinks is minorly buggy (doesn't parse <pre> properly, reported to RT) but it's far better than not being able to process the email at all.
Assignee: incoming.email → mkanat
Status: NEW → ASSIGNED
Attachment #536157 - Flags: review?(glob)
Oh, and also, this requires the patch from the blocker.
Comment on attachment 536157 [details] [diff] [review]
v1

>+    {
>+        package => 'HTML-FormatText-WithLinks',
>+        module  => 'HTML::FormatText::WithLinks',

Why not simply using HTML::Parser, which is already in our list of optional modules?
(In reply to comment #3)
> Why not simply using HTML::Parser, which is already in our list of optional
> modules?

  Because that's not a module that converts HTML to text, it's just an HTML parser.
Comment on attachment 536157 [details] [diff] [review]
v1

Review of attachment 536157 [details] [diff] [review]:
-----------------------------------------------------------------

this looks mostly good; there's even rpms and ppms for this module :)  shame it doesn't support tables.

you need to change the wording of the 'email_no_text_plain' error message, and you should also update the comment in get_body_and_attachments to indicate the error is thrown if the email does not contain any text/plain or html parts.

::: email_in.pl
@@ +342,5 @@
> +            return _decode_body($charset, $part->body);
> +        }
> +        # If we find a text/html body, decode it, but don't return
> +        # it immediately, because there might be a text/plain alternative
> +        # later. This could be any HTML type.

it would be better to remember the html part and decode it only if a text/plain part is not found.
Attachment #536157 - Flags: review?(glob) → review-
(In reply to comment #5)
> you need to change the wording of the 'email_no_text_plain' error message,
> and you should also update the comment in get_body_and_attachments to
> indicate the error is thrown if the email does not contain any text/plain or
> html parts.

  Ah, yeah, thanks!

> it would be better to remember the html part and decode it only if a
> text/plain part is not found.

  That's what it's doing, actually.
Attached patch v2Splinter Review
Okay, I fixed the error message.
Attachment #536157 - Attachment is obsolete: true
Attachment #537388 - Flags: review?
Attachment #537388 - Flags: review? → review?(glob)
Comment on attachment 537388 [details] [diff] [review]
v2

Review of attachment 537388 [details] [diff] [review]:
-----------------------------------------------------------------

r=glob
Attachment #537388 - Flags: review?(glob) → review+
Flags: approval?
Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/trunk/
modified email_in.pl
modified Bugzilla/Install/Requirements.pm
modified template/en/default/global/user-error.html.tmpl
Committed revision 7904.
Flags: approval? → approval+
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Keywords: relnote
Added to relnotes for 4.4.
Keywords: relnote
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: