|
|
@ -17,24 +17,28 @@ class Mailer |
|
|
|
public $template; |
|
|
|
public $templater; |
|
|
|
public $headers; |
|
|
|
protected $url; |
|
|
|
|
|
|
|
function __construct($template) |
|
|
|
{ |
|
|
|
$this->templater = Load::templater(ACTION_TPL_PATH.'/'.$this->template_dir); |
|
|
|
$this->template = $template; |
|
|
|
|
|
|
|
$settings = Env::getParam('site_settings'); |
|
|
|
$this->url = $settings['host_name']; |
|
|
|
|
|
|
|
/* если че забыл, не серчайте */ |
|
|
|
$this->headers .= 'From: robot@'.Env::Server('SERVER_NAME'); |
|
|
|
$this->headers .= 'From: robot@' . $this->url . "\r\n"; |
|
|
|
$this->headers .= "Date: ".$this->RFCDate()."\r\n"; |
|
|
|
$this->headers .= "From: robot@".Env::Server('SERVER_NAME')."\r\n"; |
|
|
|
$this->headers .= "Return-Path: robot@".Env::Server('SERVER_NAME')."\r\n"; |
|
|
|
$this->headers .= "From: robot@". $this->url ."\r\n"; |
|
|
|
$this->headers .= "Return-Path: robot@". $this->url ."\r\n"; |
|
|
|
$this->headers .= "X-Mailer: PHPMail Tool\r\n"; |
|
|
|
$this->headers .= "Reply-To: robot@".Env::Server('SERVER_NAME')."\r\n"; |
|
|
|
$this->headers .= "Reply-To: robot@". $this->url ."\r\n"; |
|
|
|
$this->headers .= "X-Priority: 3 (Normal)\r\n"; |
|
|
|
$this->headers .= "Message-ID: <". md5(uniqid(time()))."@".Env::Server('SERVER_NAME').">\r\n"; |
|
|
|
$this->headers .= "Message-ID: <". md5(uniqid(time()))."@". $this->url .">\r\n"; |
|
|
|
$this->headers .= "MIME-Version: 1.0\r\n"; |
|
|
|
$this->headers .= "Content-Type: text/plain; charset=windows-1251\r\n"; |
|
|
|
$this->headers .= "Content-Transfer-Encoding: 8bit\r\n"; |
|
|
|
$this->headers .= "Content-Type: text/plain; charset=utf-8\r\n"; |
|
|
|
$this->headers .= "Content-Transfer-Encoding: 16bit\r\n"; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -54,15 +58,9 @@ class Mailer |
|
|
|
$this->templater->assign($key, $val); |
|
|
|
} |
|
|
|
|
|
|
|
$message = $this->templater->fetch($this->template.'.tpl').'\r\n\r\nС любовью @робот.'; |
|
|
|
$message = $this->templater->fetch($this->template.'.tpl') . "\r\n\r\nС любовью @робот."; |
|
|
|
|
|
|
|
/* |
|
|
|
* как только заработает отправка писем на серваке, |
|
|
|
* сразу надо раскоментить и проверить |
|
|
|
* |
|
|
|
* return mail($mail, $subject, $message, $this->headers); |
|
|
|
*/ |
|
|
|
return true; |
|
|
|
return mail($mail, $subject, $message, $this->headers); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|