Jump to content

imap_open() is returning a string


pstephan1187

Recommended Posts

I am trying to connect to a mail server via imap_open(). It is supposed to return a resource Identifier, but whether it fails or succeeds, i get a string. My code:

 

<?php
ini_set('display_errors', 1);
$mbox = imap_open("{mydomain/notls}",'[email protected]','pass')."<br /><br />";
var_dump($mbox);
imap_close($mbox);
?>

 

This returns:

 

string(26) "Resource id #2

" Warning: imap_close() expects parameter 1 to be resource, string given in /var/www/vhosts/mysitemail.net/httpdocs/test.php on line 5 

 

I can't seem to find anything on the topic. How can I either get the resource or the boolean? If I try to get the imap headers with $mbox, it fails saying that $mbox is a string and not a resource. AGH!

Link to comment
https://forums.phpfreaks.com/topic/244628-imap_open-is-returning-a-string/
Share on other sites

Ever bang your head on a wall for hours only to find out you're missing a semicolon or something simple is the culprit to your problem? It might help if I removed the ."<br /><br />" from the end of the imap_open line. DUH! :facepalm: Sorry to waste your server space phpfreaks.

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.