<?php
/*********************************************
Desciption: Class for mailing
File: /includes/classes.mail.php
Project: dShop
Developers: João Vieira (brevespot.com)
Start Date: 2007/10/22
*********************************************/

class Mail_J
{
	var $mailFrom          = "none@zilch.pt";
	var $mailFromName      = "None Nepias";
	var $mailTo            = "none@nepias.pt";
	var $mailToName        = "None Zilch";
	var $mailReply         = "none@nenhures.pt";
	var $mailCharset       = "utf-8"; //iso-8859-1
	var $mailContentype    = "text/plain"; //text/html
	var $mailSubject       = "sem assunto";
	var $mailBody          = "sem corpo";
	var $mailHTML          = false;
	var $mailHTMLink       = "";
	var $mailImages        = array();
	
	function Mail_J () {
	   //require_once($_SERVER['DOCUMENT_ROOT'] . '/includes/phpMailer/class.phpmailer.php');
	}
	
	function SetMailFrom ($text) {
	   $this->mailFrom = $text;
	}
	
	function SetMailFromName ($text) {
	   $this->mailFromName = $text;
	}
	
	function SetMailTo ($text) {
	   $this->mailTo = $text;
	}
	
	function SetMailToName ($text) {
	   $this->mailToName = $text;
	}
	
	function SetMailReply ($text) {
	   $this->mailReply = $text;
	}
	
	function SetMailBody ($text) {
	   $this->mailBody = $text;
	}
	
	function SetMailCharset ($text) {
	   $this->mailCharset = $text;
	}
	
	function SetMailContentype ($text) {
	   $this->mailContentype = $text;
	}
	
	function SetMailSubject ($text) {
	   $this->mailSubject = $text;
	}
	
	function SetMailHTML ($value) {
	   $this->mailHTML = $value;
	}
	
	function SetMailHTMLink ($url) {
	   $this->mailHTMLink = $url;
	}
	
	function AddMailImages ($url) {
	   $this->mailImages[] = $url;
	}
	
	function Send() {
                
            $headers  = "from: \"" . $this->mailFromName . "\" <" . $this->mailFrom . ">\n";
            $headers .= "To: \"" . $this->mailToName . "\" <" . $this->mailTo . ">\n";
            $headers .= "Return-Path: " . $this->mailReply . "\n";
            $headers .= "Reply-To: " . $this->mailReply . "\n";
            $headers .= "MIME-Version: 1.0\n";
            $headers .= "Content-Type: " . $this->mailContentype . "; charset=" . $this->mailCharset . "\n";
            
            if ( $this->mailReply == "none@nenhures.pt" ) {
		if (!mail('', $this->mailSubject, $this->mailBody, $headers)) {
		    return false;
		}else return true;
            }else {
		if (!mail('', $this->mailSubject, $this->mailBody, $headers, '-f ' . $this->mailReply )) {
		    return false;
		}else return true;
            }
        /*        
                $mail = new PHPMailer();
                
                $mail->From     = $this->mailFrom;
                $mail->FromName = $this->mailFromName;
                $mail->Host = "mail.eurocardshop.com";
                $mail->Mailer   = "smtp";
                $mail->Username = "noreply@eurocardshop.com";
                $mail->Password = "4Kldmr5Wen2";

            if ($this->mailHTML) {
            }else {
                
                $mail->IsSMTP();
                $mail->SMTPAuth = true;
                $mail->CharSet = 'utf-8';
                $mail->AddAddress($this->mailTo, $this->mailTo);
                $mail->Subject = $this->mailSubject;
		$mail->Body    = $this->mailBody;
		$mail->Send();
            
            }
        */
       }

}
?>