Saved me a lot of work really .

I was looking for a way to use an smtp server ( microsoft exchange server in my case ) with the mail() function in php & since exchange is involved that means SMTP authentication is requierd as (relay is turned off) .
I had many results after searching, such as pear and other classes .
But phpMailer was effective and easier to use, it also support attachments , embeding & HTML format .

here is a simple usage :

$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = “EmailserverHost”; // SMTP server
$mail->SMTPAuth = true;
$mail->Username = ‘username’;
$mail->Password = ‘password’;

$mail->FromName = ‘Moody’;
$mail->From = “”;//sender addy
$mail->AddAddress(“”);//recip. email addy

$mail->Subject = “Your Subject”;
$mail->Body = “hi ! \nBLA BLA BLA !”;
$mail->WordWrap = 50;

echo “Message was not sent”;
echo “Mailer Error: ” . $mail->ErrorInfo;
echo “Message has been sent”;

More examples and tutorials can be found @

Documentation @