Sha256: e8776a6282886a0cb6880a85b5b6e60ee0970d09035fa9efdaba232689e63858

Contents?: true

Size: 969 Bytes

Versions: 9

Compression:

Stored size: 969 Bytes

Contents

module Spree
  module Admin
    class MailMethodsController < ResourceController
      after_filter :initialize_mail_settings

      def update
        if params[:mail_method][:preferred_smtp_password].blank?
          params[:mail_method].delete(:preferred_smtp_password)
        end
        super
      end

      def testmail
        @mail_method = Spree::MailMethod.find(params[:id])
        if TestMailer.test_email(@mail_method, try_spree_current_user).deliver
          flash[:success] = 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

      private
      def initialize_mail_settings
        Spree::Core::MailSettings.init
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
spree_core-1.3.5 app/controllers/spree/admin/mail_methods_controller.rb
spree_core-1.3.4 app/controllers/spree/admin/mail_methods_controller.rb
spree_core-1.3.3 app/controllers/spree/admin/mail_methods_controller.rb
spree_core-1.3.2 app/controllers/spree/admin/mail_methods_controller.rb
spree_core-1.3.1 app/controllers/spree/admin/mail_methods_controller.rb
spree_core-1.3.0 app/controllers/spree/admin/mail_methods_controller.rb
spree_core-1.3.0.rc2 app/controllers/spree/admin/mail_methods_controller.rb
dup_spree_core-1.3.0.rc1 app/controllers/spree/admin/mail_methods_controller.rb
spree_core-1.3.0.rc1 app/controllers/spree/admin/mail_methods_controller.rb