2011-03-18 11 views
3

メールをレール3に送信できませんでした。ブラウザに次のメッセージが表示されます。Rails 3 "ActionMailer :: Baseのアクション 'メソッド'が見つかりませんでした。

Unknown action 

The action 'method' could not be found for ActionMailer::Base 

ここに私が書いたコードがあります。

  1. application.rb

     
    Notifier.welcome_email(@user).deliver 
    

    1. 2.UsersController.rb

     
    class Notifier < ActionMailer::Base 
        default :from => "[email protected]" 
        default_url_options[:host] = "localhost.com:3000"

    def welcome_email(user)
    @user_email = user @url = root_url mail(:to => user.email, :subject => "Welcome to the site") end end

    Notifier.rb

ここ

 
config.action_mailer.deliver_method = :smtp 
    config.action_mailer.smtp_settings = { 
     :address => "smtp.gmail.com", 
     :port => 587, 
     :domain => 'xxxxxxx.com', 
     :user_name => '[email protected]', 
     :password => 'xxxx', 
     :authentication => 'plain', 
     :enable_starttls_auto => true 
    } 

ログメッセージが

AbstractControllerである:: ActionNotFound (アクション 'メソッド' はactionmailerの::ベースのため 見つかりませんでした):
アプリ/メーラー/通知。 RB:1:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.0.5/lib/action_dispatch/middleware/templates/rescues/unknown_actio:<top (required)>'
app/controllers/users_controller.rb:17:in
に」

レンダリング Cを作成します救助/レイアウト内n.erb (0.0ms)

+0

http://asciicasts.com/episodes/206-action-mailer-in-rails-3をご覧ください。それは私のために良いpreety働いた –

答えて

5

それは

config.action_mailer.delivery_method 

ない

config.action_mailer.deliver_method 

です。

今日私の設定で同じタイプミスが発生しました。

+0

Arg - このルビーのドキュメントの間違ったスペル! Evil http://rubydoc.info/gems/amazon-ses-mailer/0.0.4/frames – Jeff

関連する問題