// let's work out the last notification sent to this user..
$l = DB_DataObject::factory($this->table);
- $l->setFrom( array(
+
+ $lar = array(
'ontable' => $w->ontable,
'onid' => $w->onid,
- 'person_id' => $w->person_id,
- ));
+ );
+ $lar[strtolower($w->person_table).'_id'] = $w->{strtolower($w->person_table).'_id'};
+
+ $l->setFrom( $lar );
$l->whereAdd('id != '. $w->id);
$l->orderBy('sent DESC');
$l->limit(1);
// since some of them have spaces?!?!
$p->email = trim($p->email);
-
require_once 'Validate.php';
if (!Validate::email($p->email, true)) {
$ev = $this->addEvent('NOTIFY', $w, "INVALID ADDRESS: " . $p->email);
// enable cc in notify..
if (!empty($email['headers']['Cc'])) {
- $mailer = Mail::factory('smtp', array(
+ $cmailer = Mail::factory('smtp', array(
//'host' => $dom ,
// 'debug' => true
));
$email['headers']['Subject'] = "(CC): " . $email['headers']['Subject'];
- $mailer->send($email['headers']['Cc'],
+ $cmailer->send($email['headers']['Cc'],
$email['headers'], $email['body']);
}
if (!empty($email['bcc'])) {
- $mailer = Mail::factory('smtp', array(
+ $cmailer = Mail::factory('smtp', array(
//'host' => $dom ,
// 'debug' => true
));
$email['headers']['Subject'] = "(CC): " . $email['headers']['Subject'];
- $mailer->send($email['bcc'],
+ $cmailer->send($email['bcc'],
$email['headers'], $email['body']);
}
if (in_array($code, array( 421, 450, 451, 452)) && $next_try_min < (2*24*60)) {
// try again later..
// check last event for this item..
- $errmsg= $fail ? ($res->userinfo['smtpcode'] . ': ' .$res->toString()) : " - UNKNOWN ERROR";
- if (isset($res->userinfo['smtptext'])) {
+ //$errmsg= $fail ? ($res->userinfo['smtpcode'] . ': ' .$res->toString()) : " - UNKNOWN ERROR";
+ $errmsg= $res->userinfo['smtpcode'] . ': ' .$res->message ;
+ if (!empty($res->userinfo['smtptext'])) {
$errmsg= $res->userinfo['smtpcode'] . ':' . $res->userinfo['smtptext'];
}
//print_r($res);
$this->addEvent('NOTIFY', $w, 'GREYLISTED - ' . $errmsg);
$w->act_when = date('Y-m-d H:i:s', strtotime('NOW + ' . $retry . ' MINUTES'));
$w->update($ww);
- var_dump( $this->debug_str );
+
+
$this->errorHandler(date('Y-m-d h:i:s') . " - GREYLISTED - $errmsg \n");
}
$fail = true;