2011-09-17 15 views
0

私は電子メールを有効にするために魔法使いを使いました。私はwikiチュートリアルhttps://github.com/NoamB/sorcery/wiki/User-Activationに従ってきました。 私は、問題が別の問題であるため、電子メールを送信している間に問題があると確信しています。ここでSorceryを通じてアクティベーションを使用しようとしているときにRails 3のアクションメーラーがメールを送信しないのはなぜですか?

ユーザーメーラーのためのコードです:私はコンソールを介してコードを実行したとき、私はこれを取得してい

SampleApp::Application.configure do 
    # Settings specified here will take precedence over those in config/application.rb 

    config.action_mailer.delivery_method = :smtp 
    ActionMailer::Base.perform_deliveries = true 


ActionMailer::Base.smtp_settings    = { 
     :address    => "smtp.gmail.com", 
     :port     => "587", 
     :domain    => "localhost:3000", 
     :enable_starttls_auto => true, 
     :authentication  => "plain", 
     :user_name   => "[email protected]", 
     :password    => "my_pw" 
    } 

class UserMailer < ActionMailer::Base 
    default :from => "[email protected]" 

    def activation_needed_email(user) 
    @user = user 
    @url = "http://0.0.0.0:3000/users/#{user.activation_token}/activate" 

    mail :to => user.email, 
     :subject => "Welcome to PolyHerd.com" 
    end 
end 

ここに私のdevelopment.rbファイルです

ruby-1.9.2-p180 :017 > UserMailer.activation_needed_email(u).deliver 
ActionView::Template::Error: ActionView::Template::Error 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/activemodel-3.0.10/lib/active_model/attribute_methods.rb:392:in `method_missing' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/activerecord-3.0.10/lib/active_record/attribute_methods.rb:46:in `method_missing' 
    from /Users/x/sample_app/app/views/user_mailer/activation_needed_email.text.erb:1:in `_app_views_user_mailer_activation_needed_email_text_erb__925048320772673370_2171058260_3164940035285331741' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.10/lib/action_view/template.rb:135:in `block in render' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.10/lib/active_support/notifications.rb:54:in `instrument' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.10/lib/action_view/template.rb:127:in `render' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.10/lib/action_view/render/rendering.rb:59:in `block in _render_template' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.10/lib/active_support/notifications.rb:52:in `block in instrument' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.10/lib/active_support/notifications/instrumenter.rb:21:in `instrument' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.10/lib/active_support/notifications.rb:52:in `instrument' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.10/lib/action_view/render/rendering.rb:56:in `_render_template' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.10/lib/action_view/render/rendering.rb:26:in `render' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.10/lib/abstract_controller/rendering.rb:115:in `_render_template' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.10/lib/abstract_controller/rendering.rb:109:in `render_to_body' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.10/lib/abstract_controller/rendering.rb:102:in `render_to_string' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.10/lib/abstract_controller/rendering.rb:93:in `render' 
... 7 levels... 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionmailer-3.0.10/lib/action_mailer/base.rb:673:in `mail' 
    from /Users/x/sample_app/app/mailers/user_mailer.rb:14:in `activation_needed_email' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.10/lib/abstract_controller/base.rb:150:in `process_action' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.10/lib/abstract_controller/base.rb:119:in `process' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionpack-3.0.10/lib/abstract_controller/rendering.rb:41:in `process' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionmailer-3.0.10/lib/action_mailer/old_api.rb:75:in `process' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionmailer-3.0.10/lib/action_mailer/base.rb:471:in `process' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionmailer-3.0.10/lib/action_mailer/base.rb:466:in `initialize' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionmailer-3.0.10/lib/action_mailer/base.rb:450:in `new' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/actionmailer-3.0.10/lib/action_mailer/base.rb:450:in `method_missing' 
    from (irb):17 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.10/lib/rails/commands/console.rb:44:in `start' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.10/lib/rails/commands/console.rb:8:in `start' 
    from /Users/x/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.10/lib/rails/commands.rb:23:in `<top (required)>' 
    from script/rails:6:in `require' 

編集: ここにメールのテンプレートがありますate:

Welcome to PolyHerd.com, <%= @user.username %> 
=============================================== 

Congratulations, you are now a part of Poly Herd, 
your username is: <%= @user.username %>. 

To activate your account, just follow this link: <%= @url %>. 

Thanks for joining and have a great day! 
+0

テンプレートの外観はどうですか? –

+0

@Dave Newtonテンプレートを参照しているときに正確に何を意味するかわからない。 – Tony

+0

メールコンテンツのテンプレートはありますか? –

答えて

0

メールは出ていませんでした。 あなたのドメインを見て、私は私のものを変えようと誘惑を受けました。開発モードでもあります。私はそれをlocalhost:3000に変更しました。そして、メールは現在通過しています。

あなたのロック!

シモン

関連する問題