email confirmation, #62
git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@60 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
@ -17,24 +17,28 @@ class Mailer
|
|||||||
public $template;
|
public $template;
|
||||||
public $templater;
|
public $templater;
|
||||||
public $headers;
|
public $headers;
|
||||||
|
protected $url;
|
||||||
|
|
||||||
function __construct($template)
|
function __construct($template)
|
||||||
{
|
{
|
||||||
$this->templater = Load::templater(ACTION_TPL_PATH.'/'.$this->template_dir);
|
$this->templater = Load::templater(ACTION_TPL_PATH.'/'.$this->template_dir);
|
||||||
$this->template = $template;
|
$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 .= "Date: ".$this->RFCDate()."\r\n";
|
||||||
$this->headers .= "From: robot@".Env::Server('SERVER_NAME')."\r\n";
|
$this->headers .= "From: robot@". $this->url ."\r\n";
|
||||||
$this->headers .= "Return-Path: robot@".Env::Server('SERVER_NAME')."\r\n";
|
$this->headers .= "Return-Path: robot@". $this->url ."\r\n";
|
||||||
$this->headers .= "X-Mailer: PHPMail Tool\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 .= "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 .= "MIME-Version: 1.0\r\n";
|
||||||
$this->headers .= "Content-Type: text/plain; charset=windows-1251\r\n";
|
$this->headers .= "Content-Type: text/plain; charset=utf-8\r\n";
|
||||||
$this->headers .= "Content-Transfer-Encoding: 8bit\r\n";
|
$this->headers .= "Content-Transfer-Encoding: 16bit\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -54,15 +58,9 @@ class Mailer
|
|||||||
$this->templater->assign($key, $val);
|
$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 mail($mail, $subject, $message, $this->headers);
|
|
||||||
*/
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,11 +127,12 @@ class User
|
|||||||
*/
|
*/
|
||||||
static function sendActivateMail($mail, $login)
|
static function sendActivateMail($mail, $login)
|
||||||
{
|
{
|
||||||
|
$settings = Env::getParam('site_settings');
|
||||||
$model = new UserActivateModel();
|
$model = new UserActivateModel();
|
||||||
$link = 'http://'.Env::Server('SERVER_NAME').'/activate/?key=' . $model->generateKey($login, $mail);
|
$link = 'http://' . $settings['host_name'] . '/activate/?key=' . $model->generateKey($login, $mail);
|
||||||
|
|
||||||
$mailer = new Mailer('UserRegister');
|
$mailer = new Mailer('UserRegister');
|
||||||
return $mailer->send($mail, "Подтверждени E-mail ".Env::Server('SERVER_NAME'), array('link' => $link, 'site_name' => Env::Server('SERVER_NAME')));
|
return $mailer->send($mail, 'Подтверждени E-mail ' . $settings['host_name'], array('link' => $link, 'site_name' => $settings['site_url']));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user