

public function sendEmail($email,$name,$subject,array $properties = array()) {
if (empty($properties['tpl'])) return false;
$msg = $this->getChunk($properties['tpl'],$properties);
$this->modx->getService('mail', 'mail.modPHPMailer');
$this->modx->mail->set(modMail::MAIL_BODY, $msg);
$this->modx->mail->set(modMail::MAIL_FROM, $this->modx->getOption('discuss.admin_email'));
$this->modx->mail->set(modMail::MAIL_FROM_NAME, $this->modx->getOption('site_name'));
$this->modx->mail->set(modMail::MAIL_SENDER, $this->modx->getOption('discuss.admin_email'));
$this->modx->mail->set(modMail::MAIL_SUBJECT, $subject);
$this->modx->mail->address('to', $email, $name);
--> $this->modx->mail->address('bcc', $email, $name);
$this->modx->mail->address('reply-to', $this->modx->getOption('discuss.admin_email'));
$this->modx->mail->setHTML(true);
$sent = $this->modx->mail->send();
$this->modx->mail->reset();
return $sent;
}
/* send out notifications */
/** @var disUserNotification $notification */
foreach ($notifications as $notification) {
...
$sent = $discuss->sendEmail($user->email,$user->get('username'),$subject,$emailProperties);
unset($emailProperties);
}
add this-->
/** @var disBoardModerator $notification */
foreach ($notifications as $notification) {
...
$sent = $discuss->sendEmail($user->email,$user->get('username'),$subject,$emailProperties);
unset($emailProperties);
}
, but it will work.
if (empty($url)) {
/* @var disThread $thread */
$thread = $modx->getObject('disThread',(int)$scriptProperties['thread']);
if ($thread) {
$url = $thread->getUrl(true);
}
}
----------------Begin -----------------
/* get thread moderators an send notification if system setting is enbaled */
$thread = $modx->getObject('disThread',(int)$scriptProperties['thread']);
if ($thread != null && $modx->getOption('discuss.enable_notifications_moderators',null,true)){
/** @var $thread $moderators */
$moderators = $thread->getModerators();
/** @var disUser $moderator */
foreach ($moderators as $moderator) {
if ($moderator == null) { continue; }
$modx->log(modX::LOG_LEVEL_DEBUG, 'moderator get user :'.$moderator->get('id'));
$user = $modx->getObject('disUser',$moderator->get('id'));
if ($user == null) {
$modx->log(modX::LOG_LEVEL_DEBUG, 'user null: '.$moderator->get('user'));
continue;
}
/* dont notify on own posts! */
$modx->log(modX::LOG_LEVEL_DEBUG, 'author last : '.$thread->get('author_last').' user: '.$moderator->get('user'));
if ($thread->get('author_last') == $moderator->get('user')) { continue; }
$emailProperties = array_merge($scriptProperties,$moderator->toArray());
$emailProperties['tpl'] = $tpl;
$emailProperties['name'] = $scriptProperties['title'];
$emailProperties['type'] = $type;
$emailProperties['url'] = $url;
$modx->log(modX::LOG_LEVEL_DEBUG, 'send mail for thread :'.$scriptProperties['thread'].' name '.$user->get('username').' mail '.$user->email);
$sent = $sent = $discuss->sendEmail($user->email,$user->get('username'),$subject,$emailProperties);
unset($emailProperties);
}
}
-------------------------End-------------------------------------
/* send out notifications */
/** @var disUserNotification $notification */
foreach ($notifications as $notification) {
He will probably stop by and take a look at your code eventually. Heck the other week i saw him get back to a user on a totally minor point that occurred to him out of the blue from a month earlier. What a resource for us to learn 