Sha256: a2ab06633adaff8a49242fd8069225a0d8b6acf937d2ee2718b42cdb94470ec9

Contents?: true

Size: 456 Bytes

Versions: 7

Compression:

Stored size: 456 Bytes

Contents

class UcbRails::Admin::EmailTestController < UcbRails::Admin::BaseController
  
  def index
  end
  
  EMAIL_REGEXP = /\A[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}\z/

  def send_email
    email = params[:email]
    
    if email =~ EMAIL_REGEXP
      @email_result = UcbRails::TestMailer.test(email).deliver
      flash.now[:success] = 'Email sent.'
    else
      flash.now[:error] = 'Invalid email address'
    end
    
    render 'index'
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ucb_rails-0.0.14 app/controllers/ucb_rails/admin/email_test_controller.rb
ucb_rails-0.0.13 app/controllers/ucb_rails/admin/email_test_controller.rb
ucb_rails-0.0.12 app/controllers/ucb_rails/admin/email_test_controller.rb
ucb_rails-0.0.11 app/controllers/ucb_rails/admin/email_test_controller.rb
ucb_rails-0.0.10 app/controllers/ucb_rails/admin/email_test_controller.rb
ucb_rails-0.0.9 app/controllers/ucb_rails/admin/email_test_controller.rb
ucb_rails-0.0.8 app/controllers/ucb_rails/admin/email_test_controller.rb