Exemplo n.º 1
0
 $ticket_created_time = strtotime($ticket_created);
 $time = ($now_time - $ticket_created_time) / 3600;
 if ($time > 24) {
     $ticket_summary = selectWhere("summary", "ticket", "id", $ticket_id);
     $ticket_reporter = selectWhere("reporter", "ticket", "id", $ticket_id);
     $ticket_reporter_mail = selectWhere("email", "user", "user_name", $ticket_reporter);
     $ticket_owner = selectWhere("owner", "ticket", "id", $ticket_id);
     $owner = selectWhere("chinese_name", "user", "user_name", $ticket_owner);
     $ticket_owner_mail = selectWhere("email", "user", "user_name", $ticket_owner);
     $url = "http://ibug.corp.anjuke.com/ticket/detail?ticket_id=" . $ticket_id;
     $mail_body = "<b>BUG:</b><font color='red'><a href='" . $url . "'>" . $ticket_id . "</a>已超过24小时,仍未解决,请抓紧修复!</font></br><b>owner:</b>" . $owner . "</br><b>BUG存在时间:</b>" . round($time) . "小时</br><b>BUG标题:</b>" . $ticket_summary;
     if ($ticket_owner == "Tonyzhao" || $ticket_owner == "jieliu" || $ticket_owner == "ericwang" || $ticket_owner == "eddietian" || $ticket_owner == "kyouzhang" || $ticket_owner == "zhangjianliu") {
         $ticket_leader_mail = "zhangjianliu@anjuke.com,haocheng@anjuke.com";
         $mail_to = $ticket_reporter . ',' . $ticket_owner_mail;
         $cc_to = $ticket_leader_mail;
         $smtp->sendmail($mail_to, $smtp_usermail, $mail_subject, $mail_body, $mail_type, $cc_to);
     } else {
         if ($ticket_owner == "Lizzyyang" || $ticket_owner == "jieliu" || $ticket_owner == "yangcui" || $ticket_owner == "zhangtao" || $ticket_owner == "zhiwensun" || $ticket_owner == "hanjunfeng") {
             $ticket_leader_mail = "hanjunfeng@anjuke.com,haocheng@anjuke.com";
             $mail_to = $ticket_reporter . ',' . $ticket_owner_mail;
             $cc_to = $ticket_leader_mail;
             $smtp->sendmail($mail_to, $smtp_usermail, $mail_subject, $mail_body, $mail_type, $cc_to);
         } else {
             if ($ticket_owner == "kakiezhang" || $ticket_owner == "shuaiyan" || $ticket_owner == "bossni" || $ticket_owner == "jackyang") {
                 $ticket_leader_mail = "jackyang@anjuke.com,haocheng@anjuke.com";
                 $mail_to = $ticket_reporter . ',' . $ticket_owner_mail;
                 //          $mail_to="*****@*****.**";
                 $cc_to = $ticket_leader_mail;
                 $smtp->sendmail($mail_to, $smtp_usermail, $mail_subject, $mail_body, $mail_type, $cc_to);
             } else {
                 if ($ticket_owner == "dinglin" || $ticket_owner == "rayliu") {
Exemplo n.º 2
0
$count = array_merge($count_current, $count_before);
$smtp_server = APF::get_instance()->get_config('smtp_server');
$smtp_port = APF::get_instance()->get_config('smtp_port');
$smtp_user = APF::get_instance()->get_config('smtp_user');
$smtp_pass = APF::get_instance()->get_config('smtp_pass');
$smtp_usermail = APF::get_instance()->get_config('smtp_usermail');
$smtp_emailto = '*****@*****.**';
$cc_to = 'dl-tech-haozu@anjuke.com,dl-tech-pd-aifang@anjuke.com,dl-tech-pdsec@anjuke.com,dl-tech-jpse@anjuke.com,ibug@anjuke.com';
$mail_subject = '[iBug]Daily Reporter' . ' - ' . $date;
$template = new Template();
$mail_body = $template->load_daily_reporter_html_template($count);
$mail_type = 'HTML';
$smtp = new SMTP($smtp_server, $smtp_port, true, $smtp_user, $smtp_pass);
$smtp->debug = true;
$smtp->set_from("IBug No-Reply", $smtp_usermail);
$flag = $smtp->sendmail($smtp_emailto, $smtp_usermail, $mail_subject, $mail_body, $mail_type, $cc_to);
echo date('c ') . "SMTP_SERVER: {$smtp_server} \n";
echo date('c ') . "SUBJECT: {$mail_subject} \n";
echo date('c ') . "FROM: {$smtp_usermail} \n";
echo date('c ') . "TO: {$smtp_emailto} \n";
echo date('c ') . "CC: {$cc_to} \n";
if ($flag) {
    echo date('c ') . "Send Reporter Successfully!\n";
} else {
    $filename = APF::get_instance()->get_config('mail_error_log');
    $content = "Sent Daily Reporter - " . $date . " error\n";
    if (is_writable($filename)) {
        if (!($handle = fopen($filename, 'a'))) {
            echo date('c ') . "Cannot open file " . $filename . "\n";
            exit;
        }
Exemplo n.º 3
0
 private function notify()
 {
     $smtpserver = $this->smtp['smtpserver'];
     $smtpserverport = $this->smtp['smtpserverport'];
     $smtpuser = $this->smtp['smtpuser'];
     $smtppass = $this->smtp['smtppass'];
     $smtp_usermail = $this->smtp['smtp_usermail'];
     $smtp = new SMTP($smtpserver, $smtpserverport, false, $smtpuser, $smtppass);
     $smtp->set_from("SearchCloud", "*****@*****.**");
     $smtp->debug = false;
     $cc = '';
     $bcc = '';
     foreach ($this->alert as $name => $msg) {
         if (empty($msg)) {
             continue;
         }
         $userinfo = $this->get_user_info($name);
         print_r($userinfo);
         if (!empty($userinfo['email'])) {
             /*发Email*/
             $sent = $smtp->sendmail($userinfo['email'], $smtp_usermail, 'SearchCloud报警邮件', $msg, 'HTML', $cc, $bcc);
             print_r($sent);
         }
         if (!empty($userinfo['mobile'])) {
             /*发SMS*/
             $sent = $smtp->sendmail($userinfo['mobile'] . '@139.com', $smtp_usermail, 'SearchCloud报警邮件', $msg, 'HTML', $cc, $bcc);
             print_r($sent);
         }
     }
 }