tradeinthailand Posted December 23, 2007 Share Posted December 23, 2007 Hi, I am new here and new to php. I have an auto responder installed on my server to the most part it seems to work ok. There are 4 cron jobs set up with it and n one of them I get a mail arrive with the following message X-Powered-By: PHP/4.4.7 Content-type: text/html <br /> <b>Warning</b>: imap_open() [<a href='function.imap-open'>function.imap-open</a>]: Couldn't open stream {tradeinthailand.com:110/pop3}INBOX in <b>/home/tradeint/public_html/responder/robot/check_instant_messages.php</b> on line <b>19</b><br /> As I have no idea what to d about it can someone help me. Thanks Chris Link to comment https://forums.phpfreaks.com/topic/82863-cron-job-error-message-help-needed-please/ Share on other sites More sharing options...
trq Posted December 23, 2007 Share Posted December 23, 2007 Can we see the script? Link to comment https://forums.phpfreaks.com/topic/82863-cron-job-error-message-help-needed-please/#findComment-421455 Share on other sites More sharing options...
tradeinthailand Posted December 23, 2007 Author Share Posted December 23, 2007 The script is " <?php // scriptul se executa la fiecare 1 minut // si verifica daca in INBOX (pt account-ul autoresp@{sitename}) // au sosit mesaje destinate utilizatorilor (de ex: myuser@{sitename}) // daca da, atunci inregistram persoana care a trimis mail ca si // un subscriber pt utilizatorul "myuser", si in trimitem toate mesajele instante function error_page($error_message) { } require("imap_globals.php"); require("imap_functions.php"); require("../include/globals.php"); require("../include/db_mysql.php"); require("../include/phpmailer.php"); require("../include/mail.php"); set_time_limit(0); $db = new DB_Sql; $message_box = imap_open("{".$MailHost.":110/pop3}INBOX", $MailUser, $MailPassword); if ($message_box != false) { $message_number = imap_num_msg($message_box); $headers = getHeaders($message_box, 1, $message_number); // parcurgem mesajele for ($i=1; $i<=$message_number; $i++) { $subject = $headers[$i][2]; $uid = $headers[$i][6]; $from_name = $headers[$i][1]; // extragem numai numele (fara adresa de mail) $pos = strpos($from_name, "<"); if ($pos === false) $from_name = $from_name; else $from_name = substr($from_name, 0, $pos); $head = imap_fetchheader($message_box, $uid, FT_UID); $header_info = imap_headerinfo($message_box, $uid, FT_UID); $from = $header_info->from; $to = $header_info->to; foreach ($from as $id => $object) { $from_address = $object->mailbox . "@" . $object->host; } foreach ($to as $id => $object) { $to_address = $object->mailbox . "@" . $object->host; $to_user = $object->mailbox; } $body = imap_body($message_box, $uid, FT_INTERNAL); // vedem daca mesajul este adresat vreunui user al aplicatiei $query = "SELECT * FROM users WHERE users_username = '$to_user' "; $db->query($query); if ($db->num_rows() != 0) { // da, exista un user caruia i se adreseaza mailul primit $db->next_record(); $user_id = $db->f("users_id"); // verificam daca nu avem deja un subscriber cu email-ul dat // pt user-ul caruia i s-a trimis email $query = "SELECT * FROM subscribers WHERE subscribers_user_id = '$user_id' AND subscribers_email = '$from_address' "; $db->query($query); if ($db->num_rows() != 0) { // gasim id-ul subscrisului $db->next_record(); $subscriber_id = $db->f("subscribers_id"); } else { // inregistram persoana care a trimis mail // ca subscriber al user-ului caruia ii era destinat mail-ul $_head = addslashes($head); $query = "INSERT INTO subscribers ( subscribers_name, subscribers_email, subscribers_user_id, subscribers_header, subscribers_join_date ) VALUES ( '$from_name', '$from_address', '$user_id', '$_head', NOW() )"; $db->query($query); // gasim id-ul subscrisului numai ce adaugat $subscriber_id = mysql_insert_id($db->link_id()); } // trimitem toate mesajele instante ale user-ului subscrisului $query = "SELECT * FROM messages WHERE messages_user_id = '$user_id' AND messages_interval = '0' AND messages_disabled = '0' "; $db->query($query); while ($db->next_record()) { SendMessage2Subscriber($db->f("messages_id"), $subscriber_id); } // stergem mesajul imap_delete ($message_box, $uid, FT_UID); } } imap_expunge($message_box); imap_close($message_box); } ?> " Thanks for any help you can give. Chris Link to comment https://forums.phpfreaks.com/topic/82863-cron-job-error-message-help-needed-please/#findComment-421459 Share on other sites More sharing options...
tradeinthailand Posted December 23, 2007 Author Share Posted December 23, 2007 If any other information is needed just let me know. Chris Link to comment https://forums.phpfreaks.com/topic/82863-cron-job-error-message-help-needed-please/#findComment-421564 Share on other sites More sharing options...
tradeinthailand Posted December 24, 2007 Author Share Posted December 24, 2007 Can someone please help me with this problem Link to comment https://forums.phpfreaks.com/topic/82863-cron-job-error-message-help-needed-please/#findComment-422229 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.