$mime->addAttachment(
$attch['file'],
$attch['mimetype'],
- $attch['name'],
+ (!empty($attch['name'])) ? $attch['name'] : '',
true
);
}
function send()
{
+ $pg = HTML_FlexyFramework::get()->page;
+
+
$email = $this->toData();
if (is_a($email, 'PEAR_Error')) {
+ $pg->addEvent("COREMAILER-FAIL", false, "email toData failed");
+
+
return $email;
}
if ($this->debug) {
$mailOptions = PEAR::getStaticProperty('Mail','options');
//print_R($mailOptions);exit;
$mail = Mail::factory("SMTP",$mailOptions);
- $headers['Date'] = date('r');
+ $email['headers']['Date'] = date('r');
if (PEAR::isError($mail)) {
+ $pg->addEvent("COREMAILER-FAIL", false, "mail factory failed");
+
+
return $mail;
}
$rcpts = $this->rcpts == false ? $email['recipents'] : $this->rcpts;
$oe = error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
$ret = $mail->send($rcpts,$email['headers'],$email['body']);
error_reporting($oe);
+ if ($ret === true) {
+ $pg->addEvent("COREMAILER-SENT", false,
+ 'To: ' . ( is_array($rcpts) ? implode(', ', $rcpts) : $rcpts ) .
+ 'Subject: ' . @$email['headers']['Subject']
+ );
+ }
return $ret;
}