diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 63e9db72..ee0cf638 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -126,7 +126,8 @@ class UserController < Users::ApplicationController end def feedback - UserFeedback.create(user_id: current_user.id, content: params[:feedback].to_s) + user_feedback = UserFeedback.create(user_id: current_user.id, content: params[:feedback].to_s) + Notifier.user_feedback(user_feedback).deliver_later render json: {} end diff --git a/app/mailers/notifier.rb b/app/mailers/notifier.rb index ce15c9b5..b30b504a 100644 --- a/app/mailers/notifier.rb +++ b/app/mailers/notifier.rb @@ -7,4 +7,10 @@ class Notifier < ActionMailer::Base I18n.locale = :en mail to: "bterkuile+mozo-contact-form@gmail.com", subject: "[CONTACTFORM] new entry" end + + def user_feedback(feedback) + @user_feedback = feedback + I18n.locale = :en + mail to: "bterkuile+mozo-user-feedback@gmail.com", subject: "[MOZO][USER-FEEDBACK] New user feedback" + end end diff --git a/app/views/notifier/user_feedback.html.slim b/app/views/notifier/user_feedback.html.slim new file mode 100644 index 00000000..ef172157 --- /dev/null +++ b/app/views/notifier/user_feedback.html.slim @@ -0,0 +1,5 @@ +h3 New feedback received: +b User info +pre= @user_feedback.user.try(:attributes).try(:to_yaml) +b Feedback info +pre= @user_feedback.content diff --git a/config/environments/production.rb b/config/environments/production.rb index b50141a8..18e69c20 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -64,15 +64,17 @@ Qwaiter::Application.configure do config.action_mailer.default_url_options = { host: 'www.mozo.bar' } - config.action_mailer.smtp_settings = { - address: "smtp.gmail.com", - port: 587, - domain: "mozo.bar", - authentication: :plain, - user_name: "bterkuile@companytools.nl", - password: "BjTKct22", - enable_starttls_auto: true - } + + config.action_mailer.delivery_method = :sendmail + #config.action_mailer.smtp_settings = { + #address: "smtp.gmail.com", + #port: 587, + #domain: "mozo.bar", + #authentication: :plain, + #user_name: "bterkuile@companytools.nl", + #password: "BjTKct22", + #enable_starttls_auto: true + #} # Enable threaded mode # config.threadsafe!