Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29762

imap_open() works locally but not on server

$
0
0

The issue is i'm trying to get the last email from my email using php, and it works fine locally. But then I uploaded the script to the client's server, and I don't get a response. When I check the logs, I get this:

[12-Feb-2020 08:43:21 location] PHP Warning:  imap_open(): Couldn't open stream {<mail>:143/imap}INBOX in /path/triggerCall.php on line 2
[12-Feb-2020 08:43:21 location] PHP Warning:  imap_headers() expects parameter 1 to be resource, boolean given in /path/triggerCall.php on line 7
[12-Feb-2020 08:43:21 location] PHP Warning:  imap_num_msg() expects parameter 1 to be resource, boolean given in /path/triggerCall.php on line 14
[12-Feb-2020 08:43:21 location] PHP Warning:  imap_header() expects parameter 1 to be resource, boolean given in /path/triggerCall.php on line 16
[12-Feb-2020 08:43:21 location] PHP Warning:  imap_fetchbody() expects parameter 1 to be resource, boolean given in /path/triggerCall.php on line 20
[12-Feb-2020 08:43:21 location] PHP Warning:  imap_close() expects parameter 1 to be resource, boolean given in /path/triggerCall.php on line 40

This is the code:

$inbox = imap_open('{<mail>:143/imap}', '<username>', '<password>');

$headers = imap_headers($inbox);

$last = imap_num_msg($inbox);

$header = imap_header($inbox, $last); 

$body = imap_fetchbody($inbox, $last,1);

Viewing all articles
Browse latest Browse all 29762

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>