1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-03-10 11:13:06 +00:00

Add rake task to send test email. (#6511)

This commit is contained in:
Holger Just 2010-10-08 14:48:06 +02:00
parent 5b52a06b89
commit 07f7454c01

View File

@ -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
user = User.find_by_login(args[:login])
abort l(:notice_email_error, "User #{args[:login]} not found") unless user
ActionMailer::Base.raise_delivery_errors = true
begin
result = Mailer.deliver_test(User.current)
p result
puts l(:notice_email_sent, user.mail)
rescue Exception => e
abort l(:notice_email_error, e.message)
end
end
end
end