Add user feedback mailer

This commit is contained in:
2015-10-02 17:26:06 +02:00
parent b49ed8c64d
commit 79eb85a68f
4 changed files with 24 additions and 10 deletions
+2 -1
View File
@@ -126,7 +126,8 @@ class UserController < Users::ApplicationController
end end
def feedback 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: {} render json: {}
end end
+6
View File
@@ -7,4 +7,10 @@ class Notifier < ActionMailer::Base
I18n.locale = :en I18n.locale = :en
mail to: "bterkuile+mozo-contact-form@gmail.com", subject: "[CONTACTFORM] new entry" mail to: "bterkuile+mozo-contact-form@gmail.com", subject: "[CONTACTFORM] new entry"
end 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 end
@@ -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
+11 -9
View File
@@ -64,15 +64,17 @@ Qwaiter::Application.configure do
config.action_mailer.default_url_options = { config.action_mailer.default_url_options = {
host: 'www.mozo.bar' host: 'www.mozo.bar'
} }
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com", config.action_mailer.delivery_method = :sendmail
port: 587, #config.action_mailer.smtp_settings = {
domain: "mozo.bar", #address: "smtp.gmail.com",
authentication: :plain, #port: 587,
user_name: "bterkuile@companytools.nl", #domain: "mozo.bar",
password: "BjTKct22", #authentication: :plain,
enable_starttls_auto: true #user_name: "bterkuile@companytools.nl",
} #password: "BjTKct22",
#enable_starttls_auto: true
#}
# Enable threaded mode # Enable threaded mode
# config.threadsafe! # config.threadsafe!