fetch_all_by_sendtime($_G['timestamp'], 0, $pernum) as $value) { if($value['touid']) $touids[$value['touid']] = $value['touid']; $cids[] = $value['cid']; $list[$value['cid']] = $value; } if(empty($cids)) exit(); foreach(C::t('common_mailqueue')->fetch_all_by_cid($cids) as $value) { $sublist[$value['cid']][] = $value; } if($touids) { C::t('common_member_status')->update($touids, array('lastsendmail' => TIMESTAMP), 'UNBUFFERED'); } C::t('common_mailcron')->delete($cids); C::t('common_mailqueue')->delete_by_cid($cids); require_once libfile('function/mail'); foreach ($list as $cid => $value) { $mlist = $sublist[$cid]; if($value['email'] && $mlist) { $subject = getstr($mlist[0]['subject'], 80, 0, 0, 0, -1); $message = ''; if(count($mlist) == 1) { $message = '
'.$mlist[0]['message']; } else { foreach ($mlist as $subvalue) { if($subvalue['message']) { $message .= "
$subvalue[subject]
$subvalue[message]
"; } else { $message .= $subvalue['subject'].'
'; } } } if(!sendmail($value['email'], $subject, $message)) { runlog('sendmail', "$value[email] sendmail failed."); } } } ?>