Custom IMAP command in php

后端 未结 3 1368
执念已碎
执念已碎 2021-01-14 02:13

What is alternative of java imap function doCommand in php ?

I want to fire some custom imap extension command but I don\'t find any function to do that

相关标签:
3条回答
  • 2021-01-14 02:40

    если собираетесь искать через imap кириллические слова - у меня получилось так:

    if you are going to search with IMAP non english characters - do like this:

    $protocol->search(array("charset utf-8 X-GM-RAW", "Денис|test"));//это zend
    

    т.е. в итоге запрос серверу будет такой:

    a result of this request to the server will be:

    . search charset utf-8 text Живалов|test
    

    или так - используем imap расширение gmail мощный поиск:

    or so - use gmail imap extension powerful search:

    . search charset utf-8 X-GM-RAW 'Живалов'|'test'- вот так работает это апостроф на букве (Ё/тильде ~) именно в такой последовательности ни двойные кавычки, ни одинарные не работают, нуу вроде как и без всего работает:

    it works, ' this apostrophe to the letter (e / ~ tilde) in that order either double quotes or single quotes do not work, sort of like without all the work:

    . search charset utf-8 X-GM-RAW Живалов|test

    I don't know how to post here some wiki, so you can reed something here

    0 讨论(0)
  • 2021-01-14 02:52

    Zend supports custom commends, but unfortunately does not support some basic ones like getting message parts that the default PHP imap library does... :-(

    0 讨论(0)
  • 2021-01-14 03:05

    I have switched to zend imap. it supports custom command and fetch.

    which solved my problem.

    <?php
    require_once 'Zend/Mail/Storage/Imap.php';
    require_once "Zend/Mail/Protocol/Imap.php";
    require_once "Zend/Registry.php";
    $protocol = new Zend_Mail_Protocol_Imap('imap.gmail.com', 993, true);
    $protocol->login($user, $pass);
    $protocol->select('INBOX');
    $storage = new Zend_Mail_Storage_Imap($protocol);
    foreach ($storage as $messageId => $message) {
      $id = $protocol->fetch('Custom Attribute', $storage->getUniqueId($messageId));
      echo "Mail from '{$message->from}': {$message->subject} : Custom Attribute $id \n";
    }
    ?>
    
    0 讨论(0)
提交回复
热议问题