note 22517 added to function.imap-uid
| From: | php-general at lists dot php dot net | Date: | Thu, 20 Jun 2002 17:53:18 +0000 |
| Subject: | note 22517 added to function.imap-uid | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-32055@lists.php.net to get a copy of this message | ||
For those using a POP3 mailbox, this function, as noted, does not work.
One way around this is to use direct FTP communication with the mail server. For example, the
following function takes a mailbox/password and message sequence number, and from this returns the
message UID.
function fetch_UID($account, $password, $message_number)
{
$retval = 0;
$fp = fsockopen($POPMAILSERVER, 110);
if ($fp > 0)
{
$buf = fgets($fp, 1024);
fputs($fp, "USER ".$account."\n");
$buf = fgets($fp, 1024);
fputs($fp, "PASS ".$password."\n");
$buf = fgets($fp, 1024);
fputs($fp, "UIDL ".$message_number."\n");
$retval=fgets($fp, 1024);
fputs($fp, "QUIT\n");
$buf = fgets($fp,1024);
fclose($fp);
}
return substr($retval,6,30);
}
Note: 110 is the TCP port commonly associated with a POP3 mailbox. Also the substr() function is
used to trim the +OK and the message number from the beginning of the server's response.
I'm sure there are other (better) ways to do this. But after a fruitless search of the
internet, this is what I came up with, and it seems to work for me.
--
http://www.php.net/manual/en/function.imap-uid.php
http://master.php.net/manage/user-notes.php?action=edit+22517
http://master.php.net/manage/user-notes.php?action=delete+22517
http://master.php.net/manage/user-notes.php?action=reject+22517