|
|
@ -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); |
|
|
|
} |
|
|
|
} |
|
|
|
?>
|
|
|
|
?>
|