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
https://forums.phpfreaks.com/topic/20285-imap-help/
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
https://forums.phpfreaks.com/topic/20285-imap-help/#findComment-89324
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
https://forums.phpfreaks.com/topic/20285-imap-help/#findComment-89588
Share on other sites

Archived

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

×
×
  • 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.