Topic: xls mail patch
The current reporting/includes/class.mail.inc does not allow emailing of xls files. Also the CC and BCC constructs can be simplified using implode(). The following patch addresses them:
--- old/reporting/includes/class.mail.inc Mon Sep 29 21:21:28 2014
+++ new/reporting/includes/class.mail.inc Tue Feb 03 12:30:19 2015
@@ -97,6 +97,8 @@
if ($filename == $file . '.zip') return 'application/x-zip-compressed';
$file = basename($filename, '.pdf');
if ($filename == $file . '.pdf') return 'application/pdf';
+ $file = basename($filename, '.xls');
+ if ($filename == $file . '.xls') return 'application/vnd.ms-excel';
$file = basename($filename, '.csv');
if ($filename == $file . '.csv') return 'application/vnd.ms-excel';
$file = basename($filename, '.tar');
@@ -114,31 +116,17 @@
function send()
{
- // CC Empfänger hinzufügen
- $max = count($this->cc);
- if ($max > 0)
- {
- $this->header .= "Cc: ".$this->cc[0];
- for ($i = 1; $i < $max; $i++)
- {
- $this->header .= ", ".$this->cc[$i];
- }
- $this->header .= "\n";
- }
- // BCC Empfänger hinzufügen
- $max = count($this->bcc);
- if ($max > 0)
- {
- $this->header .= "Bcc: ".$this->bcc[0];
- for ($i = 1; $i < $max; $i++)
- {
- $this->header .= ", ".$this->bcc[$i];
- }
- $this->header .= "\n";
- }
+ // Add CC Recipients
+ if (!empty($this->cc))
+ $this->header .= "Cc: " . implode(", ", $this->cc) . "\n" ;
+
+ // Add BCC Recipients
+ if (!empty($this->bcc))
+ $this->header .= "Bcc: " . implode(", ", $this->bcc) . "\n" ;
+
$this->header .= "Content-Type: multipart/mixed;\n boundary=\"$this->boundary\"\n";
- // Attachment hinzufügen
+ // Add Attachments
$max = count($this->attachment);
if ($max > 0)
{
In the file reporting/includes/excel_report.inc this will enable the creation of an equivalent method End() (what a name for a class method!) that now only exists in reporting/includes/pdf_report.inc file.
@joe: can incorporate into FA 2.4 and backport it.
References:
http://stackoverflow.com/questions/9740 … l-document
http://filext.com/faq/office_mime_types.php