ruby on rails - ActionMailer Not Working -


so i'm trying make mailer site sends of users email when order created. i'm not sure how go it, i've been trying bunch of different things. currently, i've screwed badly can't app start. (not good.)

this error message: /users/brawain/rails_projects/sample_app/config/initializers/setup_mail.rb:12:in `': uninitialized constant developmentmailinterceptor (nameerror)

currently, mailer looks like:

orders controller

class orderscontroller < applicationcontroller def new    def create     @order = order.new(user_params)     if @order.save         usermailer.work_order(@user).deliver     else       render 'new'     end   end  end end 

a new file made called development_mail_interceptor.rb found in config folder in environments folder.

class developmentmailinterceptor def self.delivering_email(message) message.subject = "#{message.to} #{message.subject}" message.to = "cwolford@andover.edu" end end 

the file work_order.text.rb in views user_mailer has text in it.

in config folder in initializers folder have file titled setup_mail.rb

actionmailer::base.smtp_settings = {   :address              => "smtp.gmail.com",   :port                 => 587,   :domain               => "student.andover.edu",   :user_name            => "techmasterswork",   :password             => "happycrazy",   :authentication       => "plain",   :enable_starttls_auto => true }  actionmailer::base.default_url_options[:host] = "localhost:3000" mail.register_interceptor(developmentmailinterceptor) if rails.env.development? 

and under app have folder called mailers have file user_mailer.rb

class usermailer < actionmailer::base default from: "techmasterswork@gmail.com"  def work_order(user)   @user = user   mail to: user.email, subject: "work order form" end end 

i have sneaking suspicion should end being order_mailer.rb, i'm not sure. anyway, know needs lot of help. how fix this?

can try putting developmentmailinterceptor class in lib directory development_mail_interceptor.rb, in setup_mail.rb file, include line require 'development_mail_interceptor'


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -