Location: PHPKode > projects > JaxBlog > JaxBlog/app/common/mail.php
<?php

require("../../resource/phpmailer/class.phpmailer.php");
require("../../resource/phpmailer/class.smtp.php");
require("../../resource/phpmailer/phpmailer.lang-en.php");

function sendEmail($toAddress, $toName, $subject, $body) {

	$mail = new PHPMailer();
	
	$mail->IsSMTP();
	$mail->Host = MAIL_SERVER;
	$mail->SMTPAuth = true;
	$mail->Username = MAIL_USERNAME;
	$mail->Password = MAIL_PASSWORD;
	
	$mail->From = MAIL_USERNAME;
	$mail->FromName = MAIL_USERNAME;
	$mail->AddAddress($toAddress, $toName);
	
	$mail->WordWrap = 70;
	$mail->IsHTML(false);
	
	$mail->Subject = $subject;
	$mail->Body    = $body;
	$mail->AltBody = $body;
	
	$message = "Message has been sent";
	
	if(!$mail->Send()) {
		$message .= "Message could not be sent. <p>";
		$message .= "Mailer Error: " . $mail->ErrorInfo;
	}
	
	return $message;
}

?>
Return current item: JaxBlog