From 0093e08a44bcd97796dc7e2db086f2b5bd2f0e7b Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Sun, 31 Oct 2010 23:55:34 +0000 Subject: [PATCH] Merged r4256 from trunk. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.0-stable@4320 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/tasks/email.rake | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/tasks/email.rake b/lib/tasks/email.rake index 87b5e03ce..957d9d44c 100644 --- a/lib/tasks/email.rake +++ b/lib/tasks/email.rake @@ -165,5 +165,22 @@ END_DESC Redmine::POP3.check(pop_options, options) end + + desc "Send a test email to the user with the provided login name" + task :test, :login, :needs => :environment do |task, args| + include Redmine::I18n + abort l(:notice_email_error, "Please include the user login to test with. Example: login=examle-login") if args[:login].blank? + + user = User.find_by_login(args[:login]) + abort l(:notice_email_error, "User #{args[:login]} not found") unless user.logged? + + ActionMailer::Base.raise_delivery_errors = true + begin + Mailer.deliver_test(User.current) + puts l(:notice_email_sent, user.mail) + rescue Exception => e + abort l(:notice_email_error, e.message) + end + end end end -- 2.39.5