ryanb / letter_opener

Preview mail in the browser instead of sending.
MIT License
3.73k stars 238 forks source link

Invalid delivery method :letter_opener #75

Closed sappapp closed 11 years ago

sappapp commented 11 years ago

I have set the following setting in development.rb

Mailing Configuration Parameters

config.action_mailer.delivery_method = :letter_opener ActionMailer::Base.perform_deliveries = true ActionMailer::Base.raise_delivery_errors = false

Yet I am still receiving an error. Do you have any suggestions?

nashby commented 11 years ago

did you restart your server after adding letter_opener to the Gemfile and running bundle install?

sappapp commented 11 years ago

Yes, all of the proper steps have been taken. I've been running around in circles on this for a while.

I am also using the devise gem. Would this cause any interference?

nashby commented 11 years ago

@sappapp I don't think so. Could you please provide sample app that reproduces this issue?

hieuk09 commented 11 years ago

I got the same problem. My app is upgraded from Rails 2 to Rails 3. In Rails 2, the gem worked normally but in Rails 3 we got with the error "RuntimeError: Invalid delivery method :letter_opener". I used the gem many times before, it works well. Any help to resolve the problem?

RuntimeError: Invalid delivery method :letter_opener
    from /Users/eastagile/.rvm/gems/ruby-1.9.3-p392@myproject/gems/actionmailer-3.2.11/lib/action_mailer/delivery_methods.rb:72:in `wrap_delivery_behavior'
    from /Users/eastagile/.rvm/gems/ruby-1.9.3-p392@myproject/gems/actionmailer-3.2.11/lib/action_mailer/delivery_methods.rb:84:in `wrap_delivery_behavior!'
    from /Users/eastagile/.rvm/gems/ruby-1.9.3-p392@myproject/gems/actionmailer-3.2.11/lib/action_mailer/base.rb:641:in `mail'
    from /Users/eastagile/.rvm/gems/ruby-1.9.3-p392@myproject/gems/sendgrid-1.2.0/lib/sendgrid.rb:168:in `mail'
    from /Users/eastagile/code/myproject/app/mailers/emails.rb:964:in `full_service_signup_email'
    from /Users/eastagile/.rvm/gems/ruby-1.9.3-p392@myproject/gems/actionpack-3.2.11/lib/abstract_controller/base.rb:167:in `process_action'
nashby commented 11 years ago

@hieuk09 Since I can't reproduce it could you please create a sample app that reproduces your problem? Thanks.

hieuk09 commented 11 years ago

I couldn't reproduce it in another app ether. However, I solved this by adding

require 'letter_opener' if Rails.env.development?

into config/application.rb It seems that the gem does not automatically load.

ghost commented 11 years ago

rm -rf .bundle fixed it for me

guinslym commented 9 years ago

Thanks @theuri

itsNikolay commented 8 years ago

got the same error because I have deleted the gem from Gemfile, so add:

# Gemfile
gem 'letter_opener'
inix commented 2 years ago

rm -rf .bundle fixed it for me

This solution works for me.