hook on request dispatch, mailer refactored, #11

git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@105 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
pzinovkin
2009-10-10 20:17:13 +00:00
parent df781c8eb2
commit c7c1c95f49
2 changed files with 25 additions and 20 deletions

View File

@ -1,15 +1,15 @@
<?php
/**
* Класс для отправки мыла
*
* @copyright NetMonsters <team@netmonsters.ru>
* @link
* @package Nakon
* @subpackage face
* @since
* @version SVN: $Id$
* @filesource $URL$
*/
* Класс для отправки почты
*
* @copyright NetMonsters <team@netmonsters.ru>
* @link http://netmonsters.ru
* @package Core
* @subpackage mail
* @since
* @version SVN: $Id$
* @filesource $URL$
*/
class Mailer
{
@ -17,26 +17,24 @@ class Mailer
public $template = null;
public $templater;
public $headers;
protected $url;
protected $host;
function __construct($template = null)
function __construct($host, $template = null)
{
if ($template !== null) {
$this->templater = Load::templater(ACTION_TPL_PATH.'/'.$this->template_dir);
$this->templater = Load::templater(ACTION_TPL_PATH . '/' . $this->template_dir);
$this->template = $template;
}
$settings = Env::getParam('site_settings');
$this->url = $settings['host_name'];
$this->host = $host;
/* если че забыл, не серчайте */
$this->headers .= 'From: robot@' . $this->url . "\r\n";
$this->headers .= 'From: robot@' . $this->host . "\r\n";
$this->headers .= 'Date: '. date('r') ."\r\n";
$this->headers .= "Return-Path: robot@". $this->url ."\r\n";
$this->headers .= "Return-Path: robot@". $this->host ."\r\n";
$this->headers .= "X-Mailer: PHPMail Tool\r\n";
$this->headers .= "Reply-To: robot@". $this->url ."\r\n";
$this->headers .= "Reply-To: robot@". $this->host ."\r\n";
$this->headers .= "X-Priority: 3 (Normal)\r\n";
$this->headers .= "Message-ID: <". md5(uniqid(time()))."@". $this->url .">\r\n";
$this->headers .= "Message-ID: <". md5(uniqid(time()))."@". $this->host .">\r\n";
$this->headers .= "MIME-Version: 1.0\r\n";
$this->headers .= "Content-Type: text/plain; charset=utf-8\r\n";
$this->headers .= "Content-Transfer-Encoding: 16bit\r\n";