Example #1
0
 function init_mail()
 {
     if (defined('DISABLE_CRON')) {
         return;
     }
     $queue = getSetting('mail_queue');
     if (!$queue) {
         return;
     }
     $mail = DB::fetch_first("SELECT * FROM mail_queue LIMIT 0,1");
     if ($mail) {
         DB::query("DELETE FROM mail_queue WHERE id='{$mail[id]}'");
         $_mail = new mail_content();
         $_mail->address = $mail['to'];
         $_mail->subject = $mail['subject'];
         $_mail->message = $mail['content'];
         $sender = new mail_sender();
         $sender->sendMail($_mail);
     } else {
         saveSetting('mail_queue', 0);
     }
 }
Example #2
0
     }
     showmessage('Advance fetures activated!', 'admin.php#setting', 1);
     break;
 case 'mail_test':
     if ($formhash != $_GET['formhash']) {
         showmessage('来源不可信,请重试', 'admin.php#setting');
     }
     $to = DB::result_first("SELECT email FROM member WHERE uid='{$uid}'");
     $subject = '[贴吧签到助手] 邮件单发测试';
     $content = "<p>此封邮件仅用于检测邮件系统是否正常工作。</p><p>此封邮件是由邮件系统直接发送的</p>";
     $mail = new mail_content();
     $mail->address = $to;
     $mail->subject = $subject;
     $mail->message = $content;
     $sender = new mail_sender();
     if ($sender->sendMail($mail)) {
         $subject = '[贴吧签到助手] 邮件群发测试';
         $content = "<p>此封邮件仅用于检测邮件队列是否正常工作。</p><p>此封邮件是从系统邮件队列中读取并发送的</p>";
         DB::insert('mail_queue', array('to' => $to, 'subject' => $subject, 'content' => $content));
         saveSetting('mail_queue', 1);
         showmessage('2 封邮件已经发送,请查收', 'admin.php#setting', 2);
     } else {
         showmessage('邮件发送失败,请检查设置后重试', 'admin.php#setting', 2);
     }
     break;
 case 'send_mail':
     if ($formhash != $_POST['formhash']) {
         showmessage('来源不可信,请重试', 'admin.php#setting');
     }
     $title = daddslashes($_POST['title']);
     $content = daddslashes($_POST['content']);