<?
require_once("include/phpmailer/class.phpmailer.php");


class mailIt extends PHPMailer{

	var $mailDebug;

	function mailIt(){
		require("config/config.mail.inc.php");
		
		$this->mailDebug=$mailDebug;
		
		$this->From     = $mailFrom;
		$this->FromName = $mailFromName;
		$this->Mailer="smtp";
		$this->Host = $mailHost;

		if ($mailAuth) {
			$this->SMTPAuth = true; 
			$this->Username = $mailUsername;
			$this->Password = $mailPassword; 
		}
	
		$this->IsHTML(true);  
	}

	
	function envia($nome, $email, $assunto, $mensagem, $nomeFrom="", $emailFrom=""){
		
		$this->ClearAddresses();
		$this->Body = $mensagem;
		$this->Subject  = $assunto;   
		
		if ($nomeFrom) $this->FromName = $nomeFrom;
		if ($emailFrom) $this->From = $emailFrom;
		
		if ($this->mailDebug)
			$this->AddAddress("americo.rio@itcode.pt", "itcode");
		else
			$this->AddAddress($email, $nome);

		if(!$this->Send()) {
			$erro=1;
		} else {
			$erro=0;
		}
		return $erro;
	}

}

?>
