Re: phpmailer, swiftmailer, smtp authentication, registration email sending problems
you guys rock
just changed from sendmail to smtp, added authentication, made path changes and it works!
here is the template for my plugin
<?php
/*
Plugin Name: Swift Mailer
Description: Replace bb_mail with Swift Mailer
Version: 0.1
*/
if ( !function_exists(‘bb_mail’) ) {
function bb_mail($to, $subject, $content, $headers=”){
require_once(‘MYSWIFTFOLDER/lib/Swift.php’);
require_once(‘MYSWIFTFOLDER/lib/Swift/Connection/SMTP.php’);
$smtp =& new Swift_Connection_SMTP(“MYSMTPSERVER”, 25);
$smtp->setUsername(“MYEMAILLOGIN”);
$smtp->setpassword(“MYEMAILPASSWORD”);
$swift =& new Swift($smtp);
$from = new Swift_Address(“MYFROMEMAIL”,”MYFRIENDLYFROM”);
$message =& new Swift_Message($subject, $content);
if ($swift->send($message, $to, $from)) {return true;}
else{ echo “Message failed to send to “.$to.” from “.$from;}
$swift->disconnect();
}
}
?>