]> git.wh0rd.org Git - tt-rss.git/commitdiff
resetpass: use PhpMailer
authorAndrew Dolgov <fox@bah.spb.su>
Sun, 18 May 2008 07:32:03 +0000 (08:32 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sun, 18 May 2008 07:32:03 +0000 (08:32 +0100)
modules/pref-users.php

index 961e314f4dbee84dffdef14e9485ac4f971fb8ff..6baa5e7615cd52b0a56f806582ccd4c83d85a921 100644 (file)
                                if (MAIL_RESET_PASS && $email) {
                                        print_notice(T_sprintf("Notifying <b>%s</b>.", $email));
 
-                                       mail("$login <$email>", "Password reset notification",
+                                       require_once "MiniTemplator.class.php";
+
+                                       $tpl = new MiniTemplator;
+
+                                       $tpl->readTemplateFromFile("templates/resetpass_template.txt");
+
+                                       $tpl->setVariable('LOGIN', $login);
+                                       $tpl->setVariable('NEWPASS', $tmp_user_pwd);
+
+                                       $tpl->addBlock('message');
+
+                                       $message = "";
+
+                                       $tpl->generateOutputToString($message);
+
+                                       $mail = new PHPMailer();
+
+                                       $mail->PluginDir = "phpmailer/";
+                                       $mail->SetLanguage("en", "phpmailer/language/");
+
+                                       $mail->CharSet = "UTF-8";
+
+                                       $mail->From = DIGEST_FROM_ADDRESS;
+                                       $mail->FromName = DIGEST_FROM_NAME;
+                                       $mail->AddAddress($email, $login);
+
+                                       if (DIGEST_SMTP_HOST) {
+                                               $mail->Host = DIGEST_SMTP_HOST;
+                                               $mail->Mailer = "smtp";
+                                               $mail->Username = DIGEST_SMTP_LOGIN;
+                                               $mail->Password = DIGEST_SMTP_PASSWORD;
+                                       }
+
+                                       $mail->IsHTML(false);
+                                       $mail->Subject = __("Password change notification");
+                                       $mail->Body = $message;
+
+                                       $rc = $mail->Send();
+
+                                       if (!$rc) print_error($mail->ErrorInfo);
+
+/*                                     mail("$login <$email>", "Password reset notification",
                                                "Hi, $login.\n".
                                                "\n".
                                                "Your password for this TT-RSS installation was reset by".
                                                "Your new password is $tmp_user_pwd, please remember".
                                                        " it for later reference.\n".
                                                "\n".
-                                               "Sincerely, TT-RSS Mail Daemon.", "From: " . MAIL_FROM);
+                                               "Sincerely, TT-RSS Mail Daemon.", "From: " . MAIL_FROM); */
                                }
                                        
                                print "</div>";