Jump to content

PHPMailer


lional

Recommended Posts

I have this code working on another page but for some reason it does not seem to see the email address for the recipient. It is pulled from a MySQL table and if I use the print function it displays the email address correctly

Here is my code

$query_cl = "SELECT * from clients WHERE username = '{$_SESSION['username']}' AND password = '{$_SESSION['password']}'";
$result_cl = mysql_query($query_cl, $conn);
while ($row_cl = mysql_fetch_assoc($result_cl)){
$auth_out = $row_cl["need_auth"];
$auth_mail_out = $row_cl["auth_mail"];
}

if ($auth_out == 1) {
$to  = $auth_mail_out; // note the comma
/* subject */
$subject = "Order requiring authorization";

/* message */
$message = <<<HERE
An order has been placed that needs authorization<br>
To view the order <a href="http://www.glenstat.com/view_cart.php?" target="_blank">here</a> 
HERE;

require_once('phpmailer/class.phpmailer.php'); 
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded 


$mail             = new PHPMailer(); 


$body             = $message; 



$mail->IsSMTP(); // telling the class to use SMTP 
$mail->Host       = "mail.it-people.co.za"; // SMTP server 
//$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing) 
                                           
// 1 = errors and messages 
                                           
// 2 = messages only 
$mail->SMTPAuth   = true;                  // enable SMTP authentication 
$mail->Host       = "mail.it-people.co.za"; // sets the SMTP server 
//$mail->Port       = 25;                    // set the SMTP port for the GMAIL server 
$mail->Username   = "lional+it-people.co.za"; // SMTP account username 
$mail->Password   = "1tpe@ple";        // SMTP account password 


$mail->SetFrom('[email protected]'); 


//$mail->AddReplyTo($to); 


$mail->Subject    = $subject; 





$mail->MsgHTML($body); 



if(!$mail->Send()) { 
  
echo "Mailer Error: " . $mail->ErrorInfo; 

 

Thanks for any help

Link to comment
https://forums.phpfreaks.com/topic/198507-phpmailer/
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.