lional Posted April 14, 2010 Share Posted April 14, 2010 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 More sharing options...
Deoctor Posted April 14, 2010 Share Posted April 14, 2010 r u able to send mail.. coz it is not authorizing for me.. Link to comment https://forums.phpfreaks.com/topic/198507-phpmailer/#findComment-1041620 Share on other sites More sharing options...
lional Posted April 14, 2010 Author Share Posted April 14, 2010 yes I can send to the email address that is specified Link to comment https://forums.phpfreaks.com/topic/198507-phpmailer/#findComment-1041626 Share on other sites More sharing options...
Deoctor Posted April 14, 2010 Share Posted April 14, 2010 $row_cl["auth_mail"] is this the mail id to which u need to send mail..if yes then u need to add the address.. like this $mail->AddAddress('$row_cl["auth_mail"]'); Link to comment https://forums.phpfreaks.com/topic/198507-phpmailer/#findComment-1041628 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.