! -> Note
$ -> Affected files
-27-Jul-2009 Joe Hunt
-# Bugs in sending sales orders as email.
-$ /reporting/includes/pdf_report.inc
+28-Jul-2009 Joe Hunt
+# Bugs in sending documents as email. Seems to land in the spam filter due to bad text and scrambled name on attached documents
+$ /reporting/rep109.php
+ /reporting/includes/doctext.inc
+ /reporting/includes/doctext2.inc
+ /reporting/includes/header2.inc
+ /reporting/includes/pdf_report.inc
18-Jul-2009 Joe Hunt
# When saving a Payment to a Customer in Bank Payments (normally payment to suppliers) it was saved with wrong sign in debtor_trans (very rare).
}
// do not use standard filenames or your sensitive company data
// are world readable
- $fname = $dir.'/'.uniqid('').'.pdf';
+ if ($email == 1)
+ $fname = $dir.'/'.$this->filename;
+ else
+ $fname = $dir.'/'.uniqid('').'.pdf';
$this->Output($fname, 'F');
if ($email == 1)
{
}
require_once($path_to_root . "/reporting/includes/class.mail.inc");
$mail = new email($this->company['coy_name'], $this->company['email']);
- $from = $this->company['coy_name'] . " <" . $this->company['email'] . ">";
- if (!isset($myrow['email']) || $myrow['email'] == '') $myrow['email'] = $myrow['contact_email'];
+ if (!isset($myrow['email']) || $myrow['email'] == '')
+ $myrow['email'] = $myrow['contact_email'];
$to = $myrow['DebtorName'] . " <" . $myrow['email'] . ">";
$msg = $doc_Dear_Sirs . " " . $myrow['DebtorName'] . ",\n\n" . $doc_AttachedFile . " " . $subject .
"\n\n";
$mail->text($msg . $sender);
$mail->attachment($fname);
$ret = $mail->send();
- if (1 == 1) // just for fun and for debugging purposes!!
- {
- $from = str_replace("<", "(", $from);
- $from = str_replace(">", ")", $from);
- $to = str_replace("<", "(", $to);
- $to = str_replace(">", ")", $to);
- $msg2 = "<br>From: " . $from;
- $msg2 .= "<br>To: " . $to;
- $msg2 .= "<br>Subject: " . $subject;
- $msg2 .= "<br>Msg: " . nl2br($msg);
- $msg2 .= nl2br($sender) . "<br>";
- $msg2 .= "<br>Filepath: " . $fname . "<br>Filename: " . $this->filename . "<br>";
- }
- if (!isset($myrow['reference'])) $myrow['reference'] = '';
if (!$ret)
display_error(_("Sending document by email failed"));
else
display_notification($this->title . " " . $myrow['reference'] . " "
. _("has been sent by email."));
+ unlink($fname);
}
else
{