Jump to content

Archived

This topic is now archived and is closed to further replies.

tomfmason

imap help

Recommended Posts

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

[code]
<?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);
?>[/code]

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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
You need to call the Mail box

Here is my function
[code]
<?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][/code]

Share this post


Link to post
Share on other sites
Slight typo, I think onlyican,

[quote author=onlyican link=topic=107532.msg431588#msg431588 date=1157893699]
[code]
<?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]
[/quote]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.