<?php
/**
 * @package linea21.core
 * @subpackage mail
 * @author linea21 <info@linea21.com>
 * @version $id SVN
 * @access public
 * @license http://opensource.org/licenses/gpl-3.0.html
 */

include("../class/system/class.phpmailer.php"); 

$mail = new phpmailer();

if(defined('MAIL_USE_SSL') && MAIL_USE_SSL== true) {
	$mail->Host = MAIL_HOST_SSL;
	$mail->Port = MAIL_PORT_SSL;
}
if (defined('MAIL_MAILER')) { 
	$mail->Mailer = MAIL_MAILER;
	if(MAIL_MAILER=='sendmail') {
		if(defined('MAIL_SENDMAIL')) $mail->Sendmail = MAIL_SENDMAIL;
		}
	if(MAIL_MAILER=='smtp') {
		if(defined('MAIL_HOST')) $mail->Host = MAIL_HOST;
	}
}

if (defined('MAIL_SMTP_AUTH') && MAIL_SMTP_AUTH == true) {
	$mail->SMTPAuth = MAIL_SMTP_AUTH;
	if (defined('MAIL_SMTP_USER')) $mail->Username = MAIL_SMTP_USER;
	if (defined('MAIL_SMTP_PASS')) $mail->Password = MAIL_SMTP_PASS;
}

/**
echo "destinataire : ".$email_dest."<br />";
echo "sujet : ".$email_subject."<br />";
echo "body : ".$email_html_body."<br />";
echo "methode : ".$email_method."<br />";
echo "host : ".$mail->Host."<br />";
echo "port : ".$mail->Port."<br />";
*/

$mail->CharSet = CHARSET;
$mail->From = MAIL_FROM;
$mail->FromName = MAIL_FROMNAME;
$mail->AddAddress($email_dest);
$mail->Subject = $email_subject;
$mail->WordWrap = 75;
$mail->Body = $email_html_body;
$mail->AltBody = $email_text_body; 
$mail->AddReplyTo(MAIL_REPLY, MAIL_REPLYNAME);

$sending_result = (!$mail->Send()) ? 0 : 1;

$mail->ClearAddresses();
$mail->ClearAttachments();

?>