Skip to content
Snippets Groups Projects
Verified Commit 91de43de authored by David Gunnarsson's avatar David Gunnarsson
Browse files

Create route to send test email to admins

parent f99d8454
Branches
No related tags found
No related merge requests found
module Avo
class TestsController < ApplicationController
rate_limit to: 1, within: 1.minute, only: :send_test_email, with: -> { redirect_to avo.avo_dashboards_path.concat("/home"), alert: "You can only send one test email every 60 seconds." }
def send_test_email
AdminsMailer.test_email.deliver_later
redirect_to avo.avo_dashboards_path.concat("/home"), notice: "Test email sent successfully!"
end
end
end
......@@ -5,4 +5,8 @@ class AdminsMailer < ApplicationMailer
@user = user
mail(to: ADMINS_EMAIL, subject: "Facem: New User Created")
end
def test_email
mail(to: ADMINS_EMAIL, subject: "Facem: Test Email for Admins")
end
end
<p>Hey there,</p>
<p>this is just a test email to check how admin emails are distributed.</p>
Hey there,
this is just a test email to check how admin emails are distributed.
\ No newline at end of file
......@@ -22,5 +22,9 @@ if defined? ::Avo
get "change_password", to: "settings#edit_password", as: :settings_password
put "change_password", to: "settings#update_password"
end
scope :tests do
get "send_email_to_admins", to: "tests#send_test_email", as: :test_email_send
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment