Question on moving from phpmailer to swiftmailer
Posted: Sun Jan 04, 2009 9:03 pm
I am getting the following error when connecting to the SMTP server (note my ISP only has PHP 4.4.4)
Uncaught Error of type [swift_connectionexception] with message [Authentication failed using username '****' and password '********']
When using phpmailer, I use the exact same id and password and the e-mail is sent. Below is a the phpmailer code:
And the relevant swiftmailer code. Note using same variables for username and password:
Thanks for any help!
-- Scott
Uncaught Error of type [swift_connectionexception] with message [Authentication failed using username '****' and password '********']
When using phpmailer, I use the exact same id and password and the e-mail is sent. Below is a the phpmailer code:
Code: Select all
$mail = new PHPMailer();
$mail->SetLanguage('en');
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = $vdc_smtp_host; // specify main and backup server
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = $vdc_smtp_user; // SMTP username
$mail->Password = $vdc_smtp_pass; // SMTP password
$mail->From = $admin_email;
$mail->FromName = "Me";
$mail->AddReplyTo($admin_email, "Me");
$mail->WordWrap = 70; // set word wrap to 70 characters
$mail->IsHTML(false); // set email format to plain text
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AddAddress("you@yourdomain.org","You");
$mail->AddAddress("you2@yourdomain.org","You2");
$mail->Send();Code: Select all
require_once "swiftmail_lib/Swift.php";
require_once "swiftmail_lib/Swift/Connection/SMTP.php";
$smtp =& new Swift_Connection_SMTP($vdc_smtp_host,25);
$smtp->setUsername($vdc_smtp_user);
$smtp->setPassword($vdc_smtp_pass);
$swift =& new Swift($smtp);
$message =& new Swift_Message($subject, $body);
$recipients =& new Swift_RecipientList();
$recipients->addTo("you@yourdomain.org","you");
$recipients->addTo("you2@yourdomain.org","you2");
$swift->batchSend($message, $recipients, $admin_email);-- Scott