예제 #1
0
 public static function sendAdminCopy($subject, $message, $lists = array())
 {
     $sendcopy = Config::get('send_admin_copies');
     if ($sendcopy) {
         //$lists = cleanArray($lists);
         $mails = array();
         if (sizeof($lists) && Config::get('SEND_LISTADMIN_COPY')) {
             foreach ($lists as $list) {
                 $tmp_list = MailingList::getListById($list);
                 $mails[] = Admin::getAdmin($tmp_list->id)->email;
             }
         }
         ## hmm, do we want to be exclusive? Either listadmin or main ones
         ## could do all instead
         if (!sizeof($mails)) {
             $admin_mail = Config::get('admin_address');
             if ($c = Config::get('admin_addresses')) {
                 $mails = explode(',', $c);
             }
             $mails[] = $admin_mail;
         }
         $sent = array();
         foreach ($mails as $admin_mail) {
             $admin_mail = trim($admin_mail);
             if (!isset($sent[$admin_mail]) && !empty($admin_mail)) {
                 phpListMailer::sendMail($admin_mail, $subject, $message, phpListMailer::systemMessageHeaders($admin_mail));
                 phpList::log()->notice(s('Sending admin copy to') . ' ' . $admin_mail);
                 $sent[$admin_mail] = 1;
             }
         }
     }
 }