Mail.php problem

From: Date: Wed, 31 Jul 2002 02:09:59 +0000
Subject: Mail.php problem
References: 1 2 3 4  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-2011@lists.php.net to get a copy of this message
Hello I had some mail functionality on a php page that worked perfectly until everything was moved to a new server. I'm posting this question in hopes that someone can point me to some possibilities of where a configuration error has taken place. the error message I am currently getting is: Fatal error: Call to undefined function: send() in d:\apache13\apache\htdocs\dbo\rep_app\mls\phpinc\showingRequestDbInterface.php on line 648 That specific line in the code is: $result = $mail->send($listingAgentEmail, $hdrs, $body); this code lies in an object method. The methods code is: function mailReps($info){
         // all we get is a request Id and a listing Id
                     // we obtain infromation from newListings.
           $fields = ARRAY("repId", "address", "city");
           $table = "newListings";
           $args = "WHERE listingId = '" . $info['listingId'] . "'";
                     $listingResults = $this->selectDynamic($fields, $table, $args);
                     // we obtain information from showing requests.
           $fields = ARRAY("showingAgent", "showingOffice", "agentEmail", "primaryArea", "primaryPrefix",
                           "primarySuffix", "primaryExt", "primaryType", "secondaryArea",
                           "secondaryPrefix", "secondarySuffix", "secondaryExt", "secondaryType",
                           "DATE_FORMAT(showDate, '%b %D, %Y') AS showDate",
                           "TIME_FORMAT(startTime, '%l:%i %p') AS startTime",
                           "TIME_FORMAT(endTime, '%l:%i %p') AS endTime");
           $table = "showingRequests";
           $args = "WHERE requestId = '" . $info['requestId'] . "'";
                     $requestResults = $this->selectDynamic($fields, $table, $args);
                     // let's build phone numbers
           $phone = new phoneFormat();
                     $phone->setArea($requestResults['primaryArea']);
           $phone->setPrefix($requestResults['primaryPrefix']);
           $phone->setSuffix($requestResults['primarySuffix']);
                     $requestResults['primaryPhone'] = $phone->buildPhone();
                     $phone = new phoneFormat();
                     $phone->setArea($requestResults['secondaryArea']);
           $phone->setPrefix($requestResults['secondaryPrefix']);
           $phone->setSuffix($requestResults['secondarySuffix']);
                     $requestResults['secondaryPhone'] = $phone->buildPhone();
                     // now we switch to DBO_offic to obtain rep names and email addresses
           $this->DB = DB::connect(getDsn("office"), true);
                         if(DB::isError($this->DB))
               trigger_error("Unable to change database to DBO_office" . $this->DB->getMessage(), E_USER_ERROR);
                     $fields = ARRAY("first", "last", "email");
           $table = "reps";
           $args = "WHERE repId = '" . $listingResults['repId'] . "'";
                     $listingRepsResults = $this->selectDynamic($fields, $table, $args);
                     $listingAgent = $listingRepsResults['first'] . " " . $listingRepsResults['last'];
           $listingAgentEmail = $listingRepsResults['email'];
           unset($listingRepsResults);
                     $fields = ARRAY("first", "last");
           $table = "reps";
           $args = "WHERE repId = '" . $listingResults['repId'] . "'";
                     $mailingRepsResults = $this->selectDynamic($fields, $table, $args);
                     $mailingRepName = $mailingRepsResults['first'] . " " . $mailingRepsResults['last'];
           unset($mailingRespResults);
                     // now we switch back to dbo_mls
           $this->DB = DB::connect(getDsn("mls"), true);
                         if(DB::isError($this->DB))
               trigger_error("Unable to change database to DBO_mls" . $this->DB->getMessage(), E_USER_ERROR);
                               /*  Here we do our mail business  */
           $logo = "../images/arilogo.gif";
             $text = "text of an email";
           $html = "<html>
                       <body style=\"font-family: sans-serif;\">
                           <img src=\"arilogo.gif\">
                           <h4>" . date("m/d/y") . "</h4>
                       </body>
                   </html>";
                     $text2 = "text of an email 2";
                     $html2 = "<html>
                       <body style=\"font-family: sans-serif;\">
                       <img src=\"arilogo.gif\">
                       </body>
                   </html>";
                     $crlf = "\r\n";
           $hdrs = array('From'=> 'ARI@thepls.com', 'Subject' => 'Property Showing Request');
                     $mime = new Mail_mime($crlf);
                     $mime->addHTMLImage("../images/arilogo.gif", "gif");
                     $mime->setTXTBody($text);
           $mime->setHTMLBody($html);
                     $body = $mime->get();
           $hdrs = $mime->headers($hdrs);
           $mail =& Mail::factory('mail');
                     if(!empty($listingAgentEmail))
           {
               $result = $mail->send($listingAgentEmail, $hdrs, $body);
                             if(Mail::isError($result))
               {
                   trigger_error("Unable to send mail to Listing Agent" . $result->message(), E_USER_ERROR);
                   $mail1Status = "Failed";
               }
               else
               {
                   $mail1Status = "Sent";
               }
           }
           else
           {
               echo("
                   <script language=\"Javascript\">
                       alert('The listing Agent email address appears to contain no information, no email will be sent.');
                   </script>
               ");
           }
                     $mime->setTXTBody($text2);
           $mime->setHTMLBody($html2);
                     $body = $mime->get();
           $hdrs = $mime->headers($hdrs);
           $mail =& Mail::factory('mail');
           if(!empty($requestResults['agentEmail']))
           {
               $result = $mail->send($requestResults['agentEmail'], $hdrs, $body);
                             if(Mail::isError($result))
               {
                   trigger_error("Unable to send mail to showing Agent" . $result->message(), E_USER_ERROR);
                   $mail2Status = "Failed";
               }
               else
               {
                   $mail2Status = "Sent";
               }
           }
           else
           {
               echo("
                   <script language=\"Javascript\">
                       alert('The showing agents email address appears to contain no information, no email will be sent.');
                   </script>
               ");
               $_POST['passedShowingAgentEmailSent'] = 'No';
           }
                     //now we need to log the results of the two mailings and update their success rate.
           $fields = ARRAY("listingAgentEmailSent" => $mail1Status,
                           "showingAgentEmailSent" => $mail2Status
                           );
           $table = "confirmation";
           $key = ARRAY("requestId" => $info['requestId']);
                     if(!$this->updateDynamic($fields, $table, $key))
           {
               trigger_error("Unable to update the mail sent fields for this showing request.", E_USER_ERROR);
           }
       }
If you need to know more.. just ask. Thanks if anyone can help Joel

« previous php.pear.general (#2011) next »