ask module: send mail on development

This commit is contained in:
iCross 2013-05-29 20:54:22 +08:00 committed by chris
parent 467c2e8a3c
commit 8541033ba9
2 changed files with 14 additions and 15 deletions

View File

@ -21,7 +21,7 @@ Orbit::Application.configure do
config.active_support.deprecation = :log config.active_support.deprecation = :log
# Only use best-standards-support built into browsers # Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin config.action_dispatch.best_standards_support = :builtin
# config.cache_store = :mem_cache_store # config.cache_store = :mem_cache_store
@ -33,17 +33,16 @@ Orbit::Application.configure do
# :email_prefix => "[R4_error]", # :email_prefix => "[R4_error]",
# :sender_address => %{"notifier" <redmine@rulingcom.com>}, # :sender_address => %{"notifier" <redmine@rulingcom.com>},
# :exception_recipients => %w{chris@rulingcom.com} # :exception_recipients => %w{chris@rulingcom.com}
# config.action_mailer.delivery_method = :smtp config.action_mailer.delivery_method = :smtp
# config.action_mailer.smtp_settings = { config.action_mailer.smtp_settings = {
# :tls => true, :enable_starttls_auto => true,
# :enable_starttls_auto => true, :address => "smtp.gmail.com",
# :address => "smtp.gmail.com", :port => '587',
# :port => '587', :domain => "smtp.gmail.com",
# :domain => "smtp.gmail.com", :authentication => "plain",
# :authentication => "plain", :user_name => "redmine@rulingcom.com",
# :user_name => "redmine@rulingcom.com", :password => "rulingredmine" }
# :password => "rulingredmine" }
end end

View File

@ -13,7 +13,7 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
@ask_question.ask_reply = AskReply.new(params[:ask_reply]) @ask_question.ask_reply = AskReply.new(params[:ask_reply])
@ask_question.save @ask_question.save
if @ask_question.ask_reply.send_email? if @ask_question.ask_reply.send_email?
::AskMailer.reply(@ask_question).deliver Resque.enqueue(SendAskReplyMail, @ask_reply.ask_question.id)
end end
redirect_to panel_ask_back_end_ask_questions_path, notice: t('ask.reply_success') redirect_to panel_ask_back_end_ask_questions_path, notice: t('ask.reply_success')
end end
@ -22,7 +22,7 @@ class Panel::Ask::BackEnd::AskRepliesController < OrbitBackendController
@ask_reply = AskReply.find(params[:id]) @ask_reply = AskReply.find(params[:id])
@ask_reply.update_attributes(params[:ask_reply]) @ask_reply.update_attributes(params[:ask_reply])
if @ask_reply.send_email? if @ask_reply.send_email?
Resque.enqueue(SendAskReplyMail, @reply.ask_question.id) Resque.enqueue(SendAskReplyMail, @ask_reply.ask_question.id)
end end
redirect_to panel_ask_back_end_ask_questions_path, notice: t('ask.reply_success') redirect_to panel_ask_back_end_ask_questions_path, notice: t('ask.reply_success')
end end