Ejemplo n.º 1
0
include_once WEB_PATH . 'lib/opensys_functions.php';
$mail = new Get_Email();
$account_obj = new AmazonAccountModel();
$msg_obj = new amazonmessageModel();
$msgcat_obj = new amazonmessagecategoryModel();
$fam_obj = new FetchAmazonMessageModel();
$accounts = $account_obj->getAmazonAccountsGmail();
$path = '';
$connect = array();
$n = 0;
foreach ($accounts as $ac) {
    if ($ac['amazon_account'] != "{$argv['1']}") {
        continue;
    }
    $path = WEB_PATH . 'crontab/gmaillib/' . $ac['amazon_account'] . '/' . preg_split('/@/', $ac['gmail'])[0] . '/' . date('Y-m-d') . '/';
    $connect = $mail->mailConnect('imap.gmail.com', '993', $ac['gmail'], base64_decode($ac['password']), 'INBOX', 'ssl');
    if (!$connect) {
        die('连接失败');
    } else {
        echo "连接成功\r\n";
    }
    //获取未查看的邮件
    $date = date("d M Y", strToTime("-0 days"));
    echo $date . "\r\n";
    $uids = imap_search($connect, "SINCE \"{$date}\"  UNSEEN ", SE_UID);
    if (!$uids) {
        echo '邮箱' . $ac['gmail'] . "是空的(︶︿︶)\r\n";
        echo $ac['gmail'] . " 连接断开\r\n";
        $mail->closeMail();
        continue;
    } else {
Ejemplo n.º 2
0
$channel->queue_declare(MQ_QUEUE_AMAZON, false, true, false, false);
$channel->queue_bind(MQ_QUEUE_AMAZON, MQ_EXCHANGE_AMAZON);
echo ' [*] Waiting for messages. To exit press CTRL+C', "\n";
$callback = function ($msg) {
    //$msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
    $msg_obj = new amazonmessageModel();
    $ms = json_decode($msg->body, true);
    var_dump($msg_obj);
    extract($ms);
    $mail_get = new Get_Email();
    $receive = preg_split('/@/', $sendid)[0];
    $send = preg_split('/@/', $recieveid)[0];
    //$message_id = $msg_obj->getMessageId($mid);  //message表中的message_id
    $msg_uid = preg_replace("/{$send}/", '', $msg_obj->getMessageId($mid)['message_id']);
    echo "The Next\n";
    $connect = $mail_get->mailConnect('imap.gmail.com', '993', "{$recieveid}", "{$pwd}", 'INBOX', 'ssl');
    //$msgno=imap_msgno($connect, $massage_id);
    $mail = new PHPMailer();
    //建立邮件发送类
    $mail->SMTPDebug = 1;
    $mail->CharSet = "UTF-8";
    $mail->IsSMTP();
    // 设定使用SMTP服务
    $mail->SMTPAuth = true;
    // 启用 SMTP 验证功能
    $mail->SMTPSecure = "ssl";
    // SMTP 安全协议
    $mail->Host = "smtp.gmail.com";
    // SMTP 服务器
    $mail->Port = 465;
    // SMTP服务器的端口号