Jump to content

imap help


tomfmason

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.