?
Solved

PHP MAILER wont work on linux

Posted on 2006-04-09
5
Medium Priority
?
372 Views
Last Modified: 2008-03-06
its wierd im using a phpmailer program which the code works fine on windows XP.
if i put it on linux machine it will mail the email out but the code is missing?


<?php
    session_start();
error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING);
set_time_limit (1900);

    include_once 'mysql_query.php';
    include_once 'checkp.php';
     //include the class !
     include_once 'invoice_quote_create.class';

function emailthem($email, $PID) {      
   include_once "class.phpmailer.php";

 //Declare Class of Invoice Template
  $temp = new invoice_quote_create_template("invoice_template2.html");
       
$saywhat = "
TEST HTML <br>
$body
";
        $temp->SetParameter("say", $saywhat);
        $message = $temp->CreatePage("true");
       
$mail = new PHPMailer();

$mail->IsSMTP();                                      // set mailer to use SMTP
$mail->Host = "127.0.0.1";  // specify main and backup server
$mail->SMTPAuth = false;     // turn on SMTP authentication

$mail->From = "customerservice@MYDOMAIN.com";
$mail->FromName = "Sales";

$mail->AddAddress($email);


$mail->WordWrap = 50;                                 // set word wrap to 50 characters
$mail->IsHTML(true);                                  // set email format to HTML

$mail->Subject = "Website";
$mail->Body    =  $message;

$mail->AltBody = "
TEST  \n
";

if(!$mail->Send())
{
   echo "Quote could not be sent. <p>";
   echo "Mailer Error: " . $mail->ErrorInfo;
   exit;
}else{
      
id='$prikey'", " ", "");
}
      
//echo "Your Quote has been sent ! $a $email <br>";

}







$results = mysqlstatement("SELECT * FROM que_p", "", "", "");

for($a=0; $a < $results['totalrows']; $a++){
      
      
      $id = $results['id'][$a];
      $int = $results['interchange'][$a];
      $PID = $results['PID'][$a];
      $email = $results['email'][$a];
      
      //echo $int;
      
      if($email == ""){
            $email = "noemailentered@MYDOMAIN.com";
      }

//remove it so no duplicates
      $removeitem = mysqlstatement("delete from que_p where id='".$results['id'][$a]."'", "","");       

      
$findint = mysqlstatement("SELECT * FROM p_database where id='$PID' limit 2", "", "", "");      
      if($findint['totalrows'] > 0){
                  //email person if its already found !
                  echo "email them";
                  emailthem($email,$PID);                    
                  continue;
            }
      
       
  if($int != "") {
      emailthem($email,$PID);                    
   }



}

   



?>
0
Comment
Question by:aot2002
  • 2
  • 2
5 Comments
 
LVL 7

Expert Comment

by:JB04
ID: 16412248
What do you mean the code is missing ?
0
 
LVL 17

Expert Comment

by:davebytes
ID: 16413804
Yeah.  I'm actually a bit surprised that'd work on the average box... I guess a non-hosting system would typically have sendmail set up.  But on hosted stuff on the net, usually you'd need a particular SMTP server IP to go through.  What is failing?  (I should note I've used PHPMailer on linux for like two years plus, though sometimes used SMTP, sometimes used mail(), depending on the host box...)

-d
0
 
LVL 1

Author Comment

by:aot2002
ID: 16414119
JB04
it just sends a blank email? nothing in it? but the email does go out? wierd
------------------------------------------------




Comment from davebytes
so what is it your suggesting to fix this?
0
 
LVL 17

Accepted Solution

by:
davebytes earned 2000 total points
ID: 16414340
$mail->Body    =  $message;

have you tried printing out $message, to verify there's something in it?  echo($message) or die($message) or something?  Or just hardcoding Body to a test string?  I assume the subject comes through set?

If the mail goes out and shows up, but is otherwise blank, that'd be my first test...
0
 
LVL 1

Author Comment

by:aot2002
ID: 16414390
thanks
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month15 days, 5 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question