Bugzilla – Attachment 25603 Details for
Bug 10777
runreport.pl allows for sending html reports via email, but mimetype is wrong
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED OFF] Bug 10777 - Send html reports with the proper Content-Type
SIGNED-OFF-Bug-10777---Send-html-reports-with-the-.patch (text/plain), 2.35 KB, created by
Mark Tompsett
on 2014-02-25 06:47:20 UTC
(
hide
)
Description:
[SIGNED OFF] Bug 10777 - Send html reports with the proper Content-Type
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2014-02-25 06:47:20 UTC
Size:
2.35 KB
patch
obsolete
>From abd5e85b43f5cc4c351c3f5a02e40e5ed714df88 Mon Sep 17 00:00:00 2001 >From: Nicholas van Oudtshoorn <vanoudt@gmail.com> >Date: Thu, 22 Aug 2013 16:56:25 +0800 >Subject: [PATCH] [SIGNED OFF] Bug 10777 - Send html reports with the proper > Content-Type > >The misc/cronjobs/runreport.pl allows for sending html reports >via email. The problem is that the Content-Type isn't set to >text/html, which means that the generated html email isn't >displayed properly. > >This patch set the Content-Type, and also adds a tiny bit of >CSS to potentially alternate row colours (just to make long >reports a bit easier on the eye!) > >TEST PLAN >---------- >1. Run the script similar to this: > ./misc/cronjobs/runreport.pl --format=html --to=YOUREMAIL --subject="Bad Formatting!" REPORTNUMBER >2. Look at the email - the html code should by visible and ugly. >3. apply the patch >4. Run the script again. >5. Look at the email - the data should look nicer now. > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > misc/cronjobs/runreport.pl | 25 ++++++++++++++++++------- > 1 file changed, 18 insertions(+), 7 deletions(-) > >diff --git a/misc/cronjobs/runreport.pl b/misc/cronjobs/runreport.pl >index 2357ed8..18e175d 100755 >--- a/misc/cronjobs/runreport.pl >+++ b/misc/cronjobs/runreport.pl >@@ -241,14 +241,25 @@ foreach my $report_id (@ARGV) { > $message .= $csv->string() . "\n"; > } > } >- > if ($email){ >- my %mail = ( >- To => $to, >- From => $from, >- Subject => encode('utf8', $subject ), >- Message => encode('utf8', $message ) >- ); >+ my %mail; >+ if ($format eq 'html') { >+ $message = "<html><head><style>tr:nth-child(n+1) { background-color: #ccc;}</style></head><body>$message</body></html>"; >+ %mail = ( >+ To => $to, >+ From => $from, >+ 'Content-Type' => 'text/html', >+ Subject => encode('utf8', $subject ), >+ Message => encode('utf8', $message ) >+ ); >+ } else { >+ %mail = ( >+ To => $to, >+ From => $from, >+ Subject => encode('utf8', $subject ), >+ Message => encode('utf8', $message ) >+ ); >+ } > sendmail(%mail) or carp 'mail not sent:' . $Mail::Sendmail::error; > } else { > print $message; >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10777
:
20546
|
25603
|
26063