No newline at end of file #0

git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@106 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
aterekhov
2009-10-25 21:39:16 +00:00
parent c7c1c95f49
commit 4d493cc579
19 changed files with 65 additions and 65 deletions

View File

@ -1,12 +1,12 @@
<?php
/**
* Класс для отправки почты
*
* @copyright NetMonsters <team@netmonsters.ru>
*
* @copyright NetMonsters <team@netmonsters.ru>
* @link http://netmonsters.ru
* @package Core
* @subpackage mail
* @since
* @since
* @version SVN: $Id$
* @filesource $URL$
*/
@ -18,16 +18,16 @@ class Mailer
public $templater;
public $headers;
protected $host;
function __construct($host, $template = null)
function __construct($host, $template = null)
{
if ($template !== null) {
$this->templater = Load::templater(ACTION_TPL_PATH . '/' . $this->template_dir);
$this->template = $template;
}
$this->host = $host;
$this->headers .= 'From: robot@' . $this->host . "\r\n";
$this->headers .= 'Date: '. date('r') ."\r\n";
$this->headers .= "Return-Path: robot@". $this->host ."\r\n";
@ -43,7 +43,7 @@ class Mailer
/**
* Отправляет письма
*
*
* @param mixed $mail
* @param mixed $subject
* @param mixed $data
@ -51,19 +51,19 @@ class Mailer
function send ($mail, $subject, $data)
{
$this->headers .= "To: ".$mail."\r\n";
foreach ($data as $key => $val) {
$this->templater->assign($key, $val);
}
$message = $this->templater->fetch($this->template.'.tpl');
$encoded_subject = '=?UTF-8?B?' . base64_encode($subject) . "?=\r\n";
return mail($mail, $subject, $message, $this->headers);
}
/**
* Отправка письма с непосредственным указанием контента
*
*
* @param string $email
* @param string $subject
* @param string $content
@ -75,4 +75,4 @@ class Mailer
return mail($email, $encoded_subject, $content, $this->headers);
}
}
?>
?>