Jump to content


Photo

imap help


  • Please log in to reply
4 replies to this topic

#1 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 10 September 2006 - 12:19 PM

I tired the following code. An example straight from the manual.

<?php
$mailbox = imap_open("{mail.mydomain.net:110/pop3}", "username", "password");
if (!$mailbox) {
    echo "Unable to connect to the mail server";
}
$overview = imap_fetch_overview($mailbox, "2,4:6", 0);
if (is_array($overview)) {
   foreach ($overview as $val) {
       echo "$val->msgno - $val->date - $val->subject\n";
   }
imap_close($mailbox);		
?>

This returns nothing. I know that I have messages in this account. I am able to see the messages fine via Out Look express.

I tried removing the foreach and just placed a print_r($overview); this returned an empty array.

Any suggestions would great.

Thanks,
Tom

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#2 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 10 September 2006 - 12:52 PM

You can see it in Outlook Express?
Outlook Express downloads the mail from the mail server to your machine.
So therefor the email will not be in the Mail Box on the server no more
Tell me the problem, I will try tell you the solution

#3 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 10 September 2006 - 01:00 PM


I knew that. I tried to use imap before I set up outlook express. When I look at my mail server log I see that I am loging in and I know that I have messages but they are just not displaying

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#4 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 10 September 2006 - 01:08 PM

You need to call the Mail box

Here is my function
<?php
function getImap() {
	global $servername;
	global $username;
	global $password;
	$mbox = imap_open("{".$servername.":110/pop3/notls}INBOX", $username, $password);
	return $mbox; }

?>
	$mbox = getImap();
	$mcheck = imap_check($mbox);
	$mnum = $mcheck->Nmsgs;
$overview = imap_fetch_overview($mbox, "1:$mnum", 0);

[code][/code]

Tell me the problem, I will try tell you the solution

#5 jefkin

jefkin
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 11 September 2006 - 02:19 AM

Slight typo, I think onlyican,

<?php
function getImap() {
	global $servername;
	global $username;
	global $password;
	$mbox = imap_open("{".$servername.":110/pop3/notls}INBOX", $username, $password);
	return $mbox; }

	$mbox = getImap();
	$mcheck = imap_check($mbox);
	$mnum = $mcheck->Nmsgs;
$overview = imap_fetch_overview($mbox, "1:$mnum", 0);
?>






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users