18 public $cacheTime = 3600;
23 public $defaultEmails = array();
28 public $phpMailer = array();
38 foreach ($this->phpMailer as $prop => $value) {
39 $mail->$prop = $value;
54 if (!$recipient->skipValidation && $userRecipient =
User::model()->cache(Yii::app()->notificationManager->cacheTime)->with(
'profile')->findByAttributes(array(
'email' => $recipient->to))) {
55 if ($userRecipient->profile->send_me_notifications ==
false) {
56 Yii::trace(
"Email skipped {$recipient->to}",
'MailNotificator');
60 Yii::trace(
"Email approved {$recipient->to}",
'MailNotificator');
75 foreach ($notification->recipients as $recipient) {
78 if ($recipient->from) {
79 $mail->SetFrom($recipient->from);
81 $mail->AddAddress($recipient->to);
82 $mail->Subject = $notification->subject;
83 $mail->MsgHTML($notification->message);
86 Yii::trace(
"Mail sent success. Subject:{$notification->subject}. To:{$recipient->to}, From: {$recipient->from}",
'MailNotificator');
87 }
catch (Exception $e) {
88 Yii::log($e->getMessage(), CLogger::LEVEL_ERROR);
89 Yii::trace(
"Mail sent FAIL. Subject:{$notification->subject}. To:{$recipient->to}, From: {$recipient->from}",
'MailNotificator');