开发者

Custom IMAP command in php

开发者 https://www.devze.com 2023-02-24 12:17 出处:网络
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 here: http://php.net/manual/en/book.imap.ph开发

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 here: http://php.net/manual/en/book.imap.ph开发者_StackOverflow社区p


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";
}
?>


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


если собираетесь искать через 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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号