PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Pfad zu Maildir - imap_open



Tobias_Baus
25-12-2004, 21:06
Hallo zusammen,

ich habe ein kleines Problem mit der Funktion imap_open() (http://php3.de/manual/de/function.imap-open.php) bzw. der Funktion imap_mailboxmsginfo() (http://de3.php.net/manual/de/function.imap-mailboxmsginfo.php).

Hier erstmal der Code:

-----

$mbox = imap_open ("{mail.domain.de/pop3:110}INBOX", "username", "passwort", "OP_READONLY");

$check = imap_mailboxmsginfo ($mbox);

if ($check) {
print "Date: " . $check->Date . "<br>\n";
print "Driver: " . $check->Driver . "<br>\n";
print "Mailbox: " . $check->Mailbox . "<br>\n";
print "Messages: " . $check->Nmsgs . "<br>\n" ;
print "Recent: " . $check->Recent . "<br>\n";
print "Size: " . $check->Size . "<br>\n";
} else {
print "imap_check() failed: " . imap_lasterror() . "<br>\n";
}

imap_close ($mbox);

-----

Das liefert folgendes:

Date: Tue, 14 Dec 2004 17:28:06 +0100 (CET)
Driver: pop3
Mailbox: {mail.domain.de:110/pop3/user="username"}INBOX
Messages: 0
Recent: 0
Size: 0

Das kann eigentlich nicht sein, denn die Mailbox ist vollgestopft mit Mails. Meine bisherige Theorie lautet, dass der Mailboxadressen-String falsch ist ("{mail.domain.de/pop3:110}INBOX"). Das Problem ist nur, ich weiß nicht wie er richtig lautet muss. Ich habe schon einiges ausprobiert und es hat nichts gebracht. Im PHP-Manual steht, "der Name des Postfachs setzt sich zusammen aus der Bezeichnung des Servers und dem Pfad des Postfachs auf diesem Server". Aber woher bekomme ich den Pfad des Postfachs raus?

Ich hoffe ihr könnte mir helfen, im voraus schonmal vielen Dank.

Viele Grüße, Tobias

nEox
26-12-2004, 12:43
Hallo Tobias,

also mit den Funktionen kenn ich mich nicht aus aber probier doch einfach mal die Ordner mit diesem Code aufzulisten:

Beispiel 1. imap_open() Beispiel



$mbox = imap_open ("{your.pop.host/pop3:110}", "username", "password");

echo "<p><h1>Mailboxes</h1>\n";
$folders = imap_listmailbox ($mbox, "{your.pop.host/pop3:110}", "*");
if ($folders == false)
echo "Call failed<br>\n";
else
while (list ($key, $val) = each ($folders))
echo $val . "<br>\n";

echo "<p><h1>Headers in INBOX</h1>\n";
$headers = imap_headers ($mbox);
if ($headers == false)
echo "Call failed<br>\n";
else
while (list ($key, $val) = each ($headers))
echo $val . "<br>n";

imap_close ($mbox);


Wie gesagt, keine Ahnung obs funktioniert aber evtl. ein Versuch wert.

see ya

nEox

Tobias_Baus
27-12-2004, 10:09
Hi nEox,

das Beispiel hab ich auch schon gefunden. Liefert folgendes:


Mailboxes
{mail.tobiasbaus.de/pop3:110}INBOX

Headers in INBOX
Call failed

"Call failed" ... ich versteh es einfach nicht. :(

Weiß vielleicht jemand anders Rat?


Viele Grüße, Tobias

nEox
27-12-2004, 11:53
Hey Tobias,

evtl hilft dir diese Funktion weiter:

http://de3.php.net/manual/de/function.imap-getmailboxes.php


<?php

$mbox = imap_open ("{mail.****.de}", "****", "*****", OP_HALFOPEN)
|| die ("can't connect: " . imap_last_error());

$list = imap_getmailboxes ($mbox, "{your.imap.host}", "*");
if (is_array ($list)) {
reset ($list);
while (list( $key, $val) = each ($list)) {
print "($key) ";
print imap_utf7_decode ($val->name) . ",";
print "'" . $val->delimiter . "',";
print $val->attributes . "<br>\n";
}
} else {
print "imap_getmailboxes failed: " . imap_last_error() . "\n";
}
imap_close ($mbox);

?>

In den Beispiel von imap_open() kommt mir diese Zeile irgendwie spanisch vor:


echo "<p><h1>Headers in INBOX</h1>\n";
$headers = imap_headers ($mbox);

... denn $mbox ist doch die Referenz auf "{your.pop.host/pop3:110}" und nicht auf "{your.pop.host/pop3:110}INBOX". Vielleicht hab ichs auch nur falsch verstanden.

see ya

nEox

Tobias_Baus
30-12-2004, 11:05
Hi,

das bringt leider auch ne Fehlermeldung:

Code:


<?php
$mbox = imap_open ("{domain.tld/pop3:110}", "user", "passwort", OP_HALFOPEN) || die ("can't connect: " . imap_last_error());

$list = imap_getmailboxes ($mbox, "{domain.tld}", "*");
if (is_array ($list)) {
reset ($list);
while (list( $key, $val) = each ($list)) {
print "($key) ";
print imap_utf7_decode ($val->name) . ",";
print "'" . $val->delimiter . "',";
print $val->attributes . "<br>\n";
}
} else {
print "imap_getmailboxes failed: " . imap_last_error() . "\n";
}
imap_close ($mbox);
?>

Fehler:


Warning: imap_getmailboxes(): supplied argument is not a valid imap resource in /opt/lampp/htdocs/webseiten/mail/index.php on line 4
imap_getmailboxes failed: Mailbox is empty
Warning: imap_close(): supplied argument is not a valid imap resource in /opt/lampp/htdocs/webseiten/mail/index.php on line 16

Leer ist sie sicher nicht. Ich wette der Pfad ist falsch, ich weiß nur nicht wie die richtige Angabe lautet. Hat denn noch niemand mit IMAP-Funktionen experimentiert?

PS: Sorry dass ich erst jetzt zurückschreibe, hatte viel zu tun. ;)


Viele Grüße, Tobias