Class: Spree::Admin::MailMethodsController

Inherits:
ResourceController show all
Defined in:
app/controllers/spree/admin/mail_methods_controller.rb

Instance Method Summary collapse

Methods inherited from ResourceController

belongs_to, create, #create, destroy, #destroy, #edit, #new, new_action, #update, update

Methods included from Core::ControllerHelpers

included

Instance Method Details

#testmailObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/spree/admin/mail_methods_controller.rb', line 6

def testmail
  @mail_method = Spree::MailMethod.find(params[:id])
  if TestMailer.test_email(@mail_method, current_user).deliver
    flash.notice = t('admin.mail_methods.testmail.delivery_success')
  else
    flash[:error] = t('admin.mail_methods.testmail.delivery_error')
  end
rescue Exception => e
  flash[:error] = t('admin.mail_methods.testmail.error') % {:e => e}
ensure
  respond_with(@mail_method) { |format| format.html { redirect_to :back } }
end