convert phpmailer code to use swiftmailer instead
Posted: Thu Dec 15, 2011 1:14 pm
current code is:
somewhere above im creating a class for phpmailer with code:
then this is to send the mail which i need converted:
I figured some of the syntax must be changed such as From is now setFrom when i need to use swiftmailer..
I can't figure out all the changes.. can someone assit?
Host = ?
Port = ?
etc:
somewhere above im creating a class for phpmailer with code:
Code: Select all
require("PHPMailer/class.phpmailer.php");Code: Select all
$mail = new PHPMailer(true);
//$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = $smtp_host; // specify SMTP mail server
$mail->Port = $smtp_port; // specify SMTP Port
$mail->SMTPAuth = $smtp_auth; // turn on SMTP authentication
$mail->Username = $smtp_user; //Full SMTP username
$mail->Password =$smtp_pass; //SMTP password
$mail->CharSet = $charset_encoding;
//if($smtp_secure )
$mail->SMTPSecure =$smtp_secure; // sets the prefix to the servier
$mail->From = $row[7];
$mail->FromName = $row[6];
//$mail->Sender =$error_ret_mail;
$mail->AddAddress($Recipiant);
$mail->AddReplyTo($mail->From, $mail->FromName);
//$mail->WordWrap = 50; //optional, you can delete this line
if($row[8]=="1")
$mail->IsHTML(true); //set email format to HTML
$mail->Subject = $Subject;
$mail->Body = $final_str; //html body
$alt_content=$row[17];
$alt_content=str_replace("{UNSUBSCRIBE-LINK}","#",$alt_content);
$alt_content=str_replace("{EMAIL}",$toemail,$alt_content);
$alt_content=replaceExtraParams($mysql,$table_prefix,"$defaultname",$alt_content);
$mail->AltBody=$alt_content;I can't figure out all the changes.. can someone assit?
Host = ?
Port = ?
etc: