$from_platform = -1; $pattern_Amazon = '/amazon-selling-coach|merch\\.service05|seller-performance|' . 'notice|seller-evaluation|merchant-performance|seller-info|' . 'listing-error-feedback|seller-notification/'; $pattern_Claims = '/payments-guarantee-reply|seller-guarantee|' . 'transaction-inquiry-a|payments-guarantee|payments-garantie/'; $pattern_Messager = '/jiajust|mbula|liugaby/'; if (preg_match($pattern_Amazon, $headinfo['from'])) { $from_platform = 0; } if (preg_match($pattern_Claims, $headinfo['from'])) { $from_platform = 1; } if (preg_match($pattern_Messager, $headinfo['from'])) { $from_platform = 2; } //print_r($headinfo); $message_id = $uids[$i]; $subjet = $mail->imapUtf8($headinfo['subject']); $encode = mb_detect_encoding($subjet, array("ASCII", 'UTF-8', 'GB2312', "GBK", 'BIG5', 'ISO-8859-1')); if ($encode != 'UTF-8') { $subjet = mb_convert_encoding($subjet, 'UTF-8'); } $from = $headinfo['from']; $fromName = $mail->imapUtf8($headinfo['fromName']); $fromName = mb_convert_encoding($fromName, 'utf8'); $to = empty($headinfo['to']) ? $ac['gmail'] : $headinfo['to']; $toName = empty($headinfo['toName']) ? $ac['amazon_account'] : $headinfo['toName']; $sendtime = $headinfo['date']; $body = $mail->getBody($msgno); $pushtime = date('Y-m-d H:i:s'); $fname = $toName . $message_id . '.html'; $amazon_account = $account_obj->getAmazonAccountByGmail($to); $catrules = $msgcat_obj->getCatRules($to);