Large Posted April 16, 2003 Share Posted April 16, 2003 Can someone show me some code or a website telling me how to return a value of the number of messages on a POP3 Server. So I can put something on a front page that says ' You have 3 Messages '. Thanks in advance. Link to comment Share on other sites More sharing options...
0 Large Posted April 16, 2003 Author Share Posted April 16, 2003 No worries guys, I have worked out how to do it. Link to comment Share on other sites More sharing options...
0 Tim Dorr Veteran Posted April 16, 2003 Veteran Share Posted April 16, 2003 Well, that was quick :D Mind sharing how you were able to do it? (I assume you opened up a socket and just few raw commands...) Link to comment Share on other sites More sharing options...
0 Large Posted April 16, 2003 Author Share Posted April 16, 2003 Timdorr, I used this bit of code, obviously filling in the $ below to your POP settings. <? // mail server settings $host="Your POP Host"; $port = 110; $user = "Your Username"; $pass = "Your Password"; // open a client connection $fp = fsockopen ($host, $port, $errno, $errstr); // if a handle is not returned if (!$fp) { die("Error: could not open socket connection\n"); } else { // get the welcome message $welcome = fgets ($fp, 150); // check for success code if (substr($welcome, 0, 3) == "+OK") { // send username and read response fputs ($fp, "USER $user\n"); fgets($fp, 50); // send password and read response fputs ($fp, "PASS $pass\n"); $ack = fgets($fp, 50); // check for success code if (substr($ack, 0, 3) == "+OK") { // send status request and read response fputs ($fp, "STAT\n"); $status = fgets($fp, 50); if (substr($status, 0, 3) == "+OK") { // shut down connection fputs ($fp, "QUIT\n"); fclose ($fp); } // error getting status else { die ("Server said: $status"); } } // auth failure else { die ("Server said: $ack"); } } // bad welcome message else { die ("Bad connection string\n"); } // get status string // split by spaces $arr = explode(" ", $status); // the second element contains the total number of messages echo $arr[1] . " messages in mailbox"; } ?> Timdorr, can you give me a hand <Timdorr starts clapping, LOL !> I have a page on my active desktop and now my icon text background has gone a solid grey and so has the shadow of the icons, the shadows are no longer smooth as they should be in XP. Also I need to know how to make the page refresh every 5 mins, is their a different way then setting an active desktop schedule, ie: a command in the page. Kind regards Link to comment Share on other sites More sharing options...
0 blueghost Posted April 16, 2003 Share Posted April 16, 2003 seen as you are using php, the following should work ok header("Refresh: 300; url=<thispage.php>"); i think it has to be the first line of the page that gets processed. Link to comment Share on other sites More sharing options...
0 BxBoy Posted April 16, 2003 Share Posted April 16, 2003 I use the IMAP function to fetch the number of emails (in my sig). I like it better because it supports displaying unread *new* mail as well. Link to comment Share on other sites More sharing options...
0 blueghost Posted April 16, 2003 Share Posted April 16, 2003 i don't think there's any way to get rid of the icon problem. Link to comment Share on other sites More sharing options...
0 Tim Dorr Veteran Posted April 16, 2003 Veteran Share Posted April 16, 2003 Actually, I think windowfx 2 (from stardock) *might* be able to do that. check out the shareware version and see if it does.... Link to comment Share on other sites More sharing options...
Question
Large
Can someone show me some code or a website telling me how to return a value of the number of messages on a POP3 Server.
So I can put something on a front page that says ' You have 3 Messages '.
Thanks in advance.
Link to comment
Share on other sites
7 answers to this question
Recommended Posts