Exemplo n.º 1
0
 if (!preg_match('/<\\S+>/', $body)) {
     $body = "<pre>" . $body . "</pre>";
 }
 $mailinfo = array('message_id' => preg_split('/@/', $to)[0] . $message_id, 'recieveid' => $to, 'receivename' => $toName, 'sendid' => $from, 'sendname' => mysql_escape_string($fromName), 'subject' => mysql_escape_string($subjet), 'sendtime' => strtotime($sendtime), 'classid' => $classid, 'amazon_account' => $amazon_account[0]['amazon_account'], 'recievetimestamp' => strtotime($pushtime), 'from_platform' => $from_platform, 'messagepath' => mysql_escape_string($path . $fname), 'attachpath' => '', 'attachname' => '', 'ordernum' => $ordernum, 'buyer' => mysql_escape_string($buyer), 'seller' => mysql_escape_string($seller));
 /* $atpath	  =  WEB_PATH.'crontab/gmailattach/'.$mailinfo['msg_id'].'/';
 			if($mailAttach=$mail->getAttach($message_id,$atpath)){
 				echo "附件下载成功\r\n";
 				$atpath.= $mailAttach[0];
 				$mailinfo['attachname'] = $mailAttach[0];
 				$mailinfo['attachpath'] = $atpath;
 				imap_clearflag_full($connect,$message_id , '\\Seen',ST_UID);
 			} else {
 				echo "附件下载失败或者该邮件没有附件\r\n";
 			} */
 echo "存储开始\r\n";
 if ($msg_obj->getMsgId($mailinfo['message_id'])) {
     echo "已经存储过了\r\n";
     continue;
 }
 if (write_w_file($path . $fname, $body)) {
     echo "邮件存储成功\r\n";
     if ($msg_obj->insertMessages($mailinfo)) {
         echo "写入数据库成功!\r\n";
         $lasttime = $mailinfo['sendtime'];
         echo "\r\n";
     } else {
         echo "写入数据库失败!\r\n";
     }
 } else {
     echo '邮件存储失败';
 }