Пример #1
0
 public function doPoslatMail()
 {
     $gid = $this->getParam('game_type_id', INPUT_POST);
     $subject = $this->getParam('subject', INPUT_POST);
     $body = $this->getParam('mail_body', INPUT_POST);
     $users = $gid == self::ALL_USERS_GT_ID ? Views\UserExtended::fetchAll($this->pdo) : Views\Subscription::fetchUsersByGame($this->pdo, $gid);
     $result = MailSender::send($users, $body, $subject);
     if ($result['result']) {
         $this->message->success($result['message']);
     } else {
         $this->message->danger($result['message']);
     }
     $this->redirectPars('sprava', $this->getDefaultAction());
 }
Пример #2
0
 private static function renderAndSend($users, $pars, $template, $subject = null)
 {
     $body = self::$twig->render("mailTemplates/{$template}.twig", $pars);
     MailSender::send($users, $body, $subject);
 }