PHP Doku:: Liefert einen Baum zusammenhängender Nachrichten - function.imap-thread.html

Verlauf / Chronik / History: (8) anzeigen

Sie sind hier:
Doku-Startseite ≥ PHP-Handbuch ≥ Funktionsreferenz ≥ E-Mail-relevante Erweiterungen ≥ IMAP, POP3 and NNTP ≥ IMAP Funktionen ≥ imap_thread

Ein Service von Reinhard Neidl - Webprogrammierung.

IMAP Funktionen

<<imap_subscribe

imap_timeout>>

imap_thread

(PHP 4 >= 4.0.7, PHP 5)

imap_thread — Liefert einen Baum zusammenhängender Nachrichten

Beschreibung

array imap_thread ( resource $imap_stream [, int $options = SE_FREE ] )

Liefert einen Baum von zusammenhängenden Nachrichten.

Parameter-Liste

imap_stream

Eine von imap_open() zurückgegebene IMAP-Verbindung.

options

Rückgabewerte

imap_thread() liefert ein assoziatives Array von Nachrichten die über REFERENCES verknüpft sind oder FALSE bei Fehlern.

Jede Nachricht im aktuellen Postfach wird im zurückgegebenen Array durch drei Einträge repräsentiert:

  • $thread["XX.num"] - aktuelle Nachrichtennummer

  • $thread["XX.next"]

  • $thread["XX.branch"]

Beispiele

Beispiel #1 imap_thread() Example

<?php

// Ausgabe der verschiedenen Themenstränge einer Newsgroup in HTML

$nntp = imap_open('{news.example.com:119/nntp}some.newsgroup', '', '');
$threads = imap_thread($nntp);

foreach (
$threads as $key => $val) {
  
$tree = explode('.', $key);
  if (
$tree[1] == 'num') {
    
$header = imap_headerinfo($nntp, $val);
    echo 
"<ul>\n\t<li>" . $header->fromaddress . "\n";
  } elseif (
$tree[1] == 'branch') {
    echo 
"\t</li>\n</ul>\n";
  }
}

imap_close($nntp);

?>


2 BenutzerBeiträge:
- Beiträge aktualisieren...
whamill at google mail
26.04.2010 23:23
I figure other people may benefit from an explanation of the resulting array, My understanding is:

Key: Essentially a node ID
Num: The mail ID (where 0 indicates the start of a conversation)
Next: The node ID of the first child (where 0 indicates there are no children)
Branch: The node ID of the next sibling (where 0 indicates there is no sibling)
mail at moritz-lapp dot de
5.08.2004 10:47
One possible option to imap_thread is the constant SE_UID, which will make imap_thread return UIDs instead of sequence numbers in the x.num-fields of the returned array.



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)