From 6c9f124eccef5eb06fc12597cab816337bf33b8c Mon Sep 17 00:00:00 2001 From: ejikharev Date: Tue, 13 Jan 2009 09:26:08 +0000 Subject: [PATCH] add method for users and edit mailer git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@41 4cb57b5f-5bbd-dd11-951b-001d605cbbc5 --- classes/Mailer.class.php | 3 ++- classes/User.class.php | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/classes/Mailer.class.php b/classes/Mailer.class.php index b778606..802b28b 100644 --- a/classes/Mailer.class.php +++ b/classes/Mailer.class.php @@ -60,8 +60,9 @@ class Mailer * как только заработает отправка писем на серваке, * сразу надо раскоментить и проверить * - * mail($mail, $subject, $message, $this->headers); + * return mail($mail, $subject, $message, $this->headers); */ + return true; } diff --git a/classes/User.class.php b/classes/User.class.php index 8a79e69..16396fc 100644 --- a/classes/User.class.php +++ b/classes/User.class.php @@ -114,5 +114,21 @@ class User return Load::model('UserData')->getById($id); } + + /** + * отправляет письмо для активации + * + * @param string $mail + * @param string $login + * + */ + static function sendActivateMail($mail, $login) + { + $link = 'http://'.Env::Server('SERVER_NAME').'/activate/?key='.Load::model('UserActivate')->generateKey($login, $mail); + + $mailer = new Mailer('UserRegister'); + return $mailer->send($mail, "Подтверждени E-mail ".Env::Server('SERVER_NAME'), array('link' => $link, 'site_name' => Env::Server('SERVER_NAME'))); + } + } ?> \ No newline at end of file