@@ -165,5 +165,22 END_DESC | |||||
165 |
|
165 | |||
166 | Redmine::POP3.check(pop_options, options) |
|
166 | Redmine::POP3.check(pop_options, options) | |
167 | end |
|
167 | end | |
|
168 | ||||
|
169 | desc "Send a test email to the user with the provided login name" | |||
|
170 | task :test, :login, :needs => :environment do |task, args| | |||
|
171 | include Redmine::I18n | |||
|
172 | abort l(:notice_email_error, "Please include the user login to test with. Example: login=examle-login") if args[:login].blank? | |||
|
173 | ||||
|
174 | user = User.find_by_login(args[:login]) | |||
|
175 | abort l(:notice_email_error, "User #{args[:login]} not found") unless user.logged? | |||
|
176 | ||||
|
177 | ActionMailer::Base.raise_delivery_errors = true | |||
|
178 | begin | |||
|
179 | Mailer.deliver_test(User.current) | |||
|
180 | puts l(:notice_email_sent, user.mail) | |||
|
181 | rescue Exception => e | |||
|
182 | abort l(:notice_email_error, e.message) | |||
|
183 | end | |||
|
184 | end | |||
168 | end |
|
185 | end | |
169 | end |
|
186 | end |
General Comments 0
You need to be logged in to leave comments.
Login now