Mercurial > hg > soundsoftware-site
diff lib/tasks/.svn/text-base/email.rake.svn-base @ 37:94944d00e43c
* Update to SVN trunk rev 4411
author | Chris Cannam <chris.cannam@soundsoftware.ac.uk> |
---|---|
date | Fri, 19 Nov 2010 13:24:41 +0000 |
parents | 513646585e45 |
children | cbce1fd3b1b7 |
line wrap: on
line diff
--- a/lib/tasks/.svn/text-base/email.rake.svn-base Fri Sep 24 14:06:04 2010 +0100 +++ b/lib/tasks/.svn/text-base/email.rake.svn-base Fri Nov 19 13:24:41 2010 +0000 @@ -165,5 +165,22 @@ 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