Jump to content

Error message problem


tradeinthailand

Recommended Posts

Hi, First Happy New Year to everyone.

I hope 2008 becomes the best ever year for you all and your loved ones.

 

I am running an auto responder on my server. It stores data in an SQL file and uses PHP script.

 

(I am very new to PHP and SQL)

 

There are 4 jobs that rune under the cron jobs and one is sending me an error message which I do not understand. Could someone help me please.

 

the message I am receiving is:-

X-Powered-By: PHP/4.4.7

Content-type: text/html

 

Warning:  imap_open() [<a href='function.imap-open'>function.imap-open[/url]]: Couldn't open stream {tradeinthailand.com:110/pop3}INBOX in /home/tradeint/public_html/responder/robot/check_instant_messages.php on line 19

 

The script (/home/tradeint/public_html/responder/robot/check_instant_messages.php) code for the cron job 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);

  }

 

?>

 

 

I would be very grateful for any help. If you need more information please just ask..

 

Thanks

 

Chris R

 

Link to comment
https://forums.phpfreaks.com/topic/83936-error-message-problem/
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.