2012-06-03 97 views
2

試圖安裝芯棒SMTP在我的Rails應用程序..當我去註冊一個用戶,我收到以下錯誤:Rails的SMTP錯誤

Net::SMTPFatalError in RegistrationsController#create 

554 5.7.1 <[email protected]>: Relay access denied 

The mandrill setup guide說:"# In a controller: YourMailer.email_name.deliver" ..即時通訊不知道如何配置此,我沒有在我的註冊控制器中有任何東西。下面

/Users/nelsonkeating/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/smtp.rb:954:in `check_response' 
/Users/nelsonkeating/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/smtp.rb:923:in `getok' 
/Users/nelsonkeating/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/smtp.rb:866:in `rcptto' 
/Users/nelsonkeating/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/smtp.rb:847:in `block in rcptto_list' 
/Users/nelsonkeating/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/smtp.rb:845:in `each' 
/Users/nelsonkeating/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/smtp.rb:845:in `rcptto_list' 
/Users/nelsonkeating/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/smtp.rb:666:in `send_message' 
mail (2.4.4) lib/mail/network/delivery_methods/smtp.rb:145:in `block in deliver!' 
/Users/nelsonkeating/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/smtp.rb:526:in `start' 
mail (2.4.4) lib/mail/network/delivery_methods/smtp.rb:144:in `deliver!' 
mail (2.4.4) lib/mail/message.rb:2034:in `do_delivery' 
mail (2.4.4) lib/mail/message.rb:229:in `block in deliver' 
actionmailer (3.2.3) lib/action_mailer/base.rb:414:in `block in deliver_mail' 
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `block in instrument' 
activesupport (3.2.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `instrument' 
actionmailer (3.2.3) lib/action_mailer/base.rb:412:in `deliver_mail' 
mail (2.4.4) lib/mail/message.rb:229:in `deliver' 
devise (2.1.0) lib/devise/models/confirmable.rb:128:in `send_on_create_confirmation_instructions' 
activesupport (3.2.3) lib/active_support/callbacks.rb:420:in `_run__2902994895577254923__create__297803661615302062__callbacks' 
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback' 
activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_create_callbacks' 
activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks' 
activerecord (3.2.3) lib/active_record/callbacks.rb:268:in `create' 
activerecord (3.2.3) lib/active_record/persistence.rb:344:in `create_or_update' 
activerecord (3.2.3) lib/active_record/callbacks.rb:264:in `block in create_or_update' 
activesupport (3.2.3) lib/active_support/callbacks.rb:414:in `_run__2902994895577254923__save__297803661615302062__callbacks' 
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback' 
activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_save_callbacks' 
activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks' 
activerecord (3.2.3) lib/active_record/callbacks.rb:264:in `create_or_update' 
activerecord (3.2.3) lib/active_record/persistence.rb:84:in `save' 
activerecord (3.2.3) lib/active_record/validations.rb:50:in `save' 
activerecord (3.2.3) lib/active_record/attribute_methods/dirty.rb:22:in `save' 
activerecord (3.2.3) lib/active_record/transactions.rb:241:in `block (2 levels) in save' 
activerecord (3.2.3) lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status' 
activerecord (3.2.3) lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction' 
activerecord (3.2.3) lib/active_record/transactions.rb:208:in `transaction' 
activerecord (3.2.3) lib/active_record/transactions.rb:293:in `with_transaction_returning_status' 
activerecord (3.2.3) lib/active_record/transactions.rb:241:in `block in save' 
activerecord (3.2.3) lib/active_record/transactions.rb:252:in `rollback_active_record_state!' 
activerecord (3.2.3) lib/active_record/transactions.rb:240:in `save' 
devise (2.1.0) app/controllers/devise/registrations_controller.rb:15:in `create' 
actionpack (3.2.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action' 
actionpack (3.2.3) lib/abstract_controller/base.rb:167:in `process_action' 
actionpack (3.2.3) lib/action_controller/metal/rendering.rb:10:in `process_action' 
actionpack (3.2.3) lib/abstract_controller/callbacks.rb:18:in `block in process_action' 
activesupport (3.2.3) lib/active_support/callbacks.rb:436:in `_run__1577789481977373940__process_action__3613823028843665787__callbacks' 
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback' 
activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks' 
activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks' 
actionpack (3.2.3) lib/abstract_controller/callbacks.rb:17:in `process_action' 
actionpack (3.2.3) lib/action_controller/metal/rescue.rb:29:in `process_action' 
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action' 
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `block in instrument' 
activesupport (3.2.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
activesupport (3.2.3) lib/active_support/notifications.rb:123:in `instrument' 
actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action' 
actionpack (3.2.3) lib/action_controller/metal/params_wrapper.rb:205:in `process_action' 
activerecord (3.2.3) lib/active_record/railties/controller_runtime.rb:18:in `process_action' 
actionpack (3.2.3) lib/abstract_controller/base.rb:121:in `process' 
actionpack (3.2.3) lib/abstract_controller/rendering.rb:45:in `process' 
actionpack (3.2.3) lib/action_controller/metal.rb:203:in `dispatch' 
actionpack (3.2.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch' 
actionpack (3.2.3) lib/action_controller/metal.rb:246:in `block in action' 
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:73:in `call' 
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:73:in `dispatch' 
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:36:in `call' 
actionpack (3.2.3) lib/action_dispatch/routing/mapper.rb:40:in `call' 
journey (1.0.3) lib/journey/router.rb:68:in `block in call' 
journey (1.0.3) lib/journey/router.rb:56:in `each' 
journey (1.0.3) lib/journey/router.rb:56:in `call' 
actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:600:in `call' 
rack-pjax (0.5.9) lib/rack/pjax.rb:12:in `call' 
client_side_validations (3.1.4) lib/client_side_validations/middleware.rb:18:in `call' 
warden (1.1.1) lib/warden/manager.rb:35:in `block in call' 
warden (1.1.1) lib/warden/manager.rb:34:in `catch' 
warden (1.1.1) lib/warden/manager.rb:34:in `call' 
actionpack (3.2.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' 
rack (1.4.1) lib/rack/etag.rb:23:in `call' 
rack (1.4.1) lib/rack/conditionalget.rb:35:in `call' 
actionpack (3.2.3) lib/action_dispatch/middleware/head.rb:14:in `call' 
remotipart (1.0.2) lib/remotipart/middleware.rb:30:in `call' 
actionpack (3.2.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call' 
actionpack (3.2.3) lib/action_dispatch/middleware/flash.rb:242:in `call' 
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context' 
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call' 
actionpack (3.2.3) lib/action_dispatch/middleware/cookies.rb:338:in `call' 
activerecord (3.2.3) lib/active_record/query_cache.rb:64:in `call' 
activerecord (3.2.3) lib/active_record/connection_adapters/abstract/connection_pool.rb:467:in `call' 
actionpack (3.2.3) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call' 
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `_run__329187641558693815__call__297803661615302062__callbacks' 
activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback' 
activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_call_callbacks' 
activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks' 
actionpack (3.2.3) lib/action_dispatch/middleware/callbacks.rb:27:in `call' 
actionpack (3.2.3) lib/action_dispatch/middleware/reloader.rb:65:in `call' 
actionpack (3.2.3) lib/action_dispatch/middleware/remote_ip.rb:31:in `call' 
actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call' 
actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call' 
railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app' 
railties (3.2.3) lib/rails/rack/logger.rb:16:in `call' 
actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:in `call' 
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call' 
rack (1.4.1) lib/rack/runtime.rb:17:in `call' 
activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call' 
rack (1.4.1) lib/rack/lock.rb:15:in `call' 
actionpack (3.2.3) lib/action_dispatch/middleware/static.rb:62:in `call' 
railties (3.2.3) lib/rails/engine.rb:479:in `call' 
railties (3.2.3) lib/rails/application.rb:220:in `call' 
rack (1.4.1) lib/rack/content_length.rb:14:in `call' 
railties (3.2.3) lib/rails/rack/log_tailer.rb:14:in `call' 
thin (1.3.1) lib/thin/connection.rb:80:in `block in pre_process' 
thin (1.3.1) lib/thin/connection.rb:78:in `catch' 
thin (1.3.1) lib/thin/connection.rb:78:in `pre_process' 
thin (1.3.1) lib/thin/connection.rb:53:in `process' 
thin (1.3.1) lib/thin/connection.rb:38:in `receive_data' 
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine' 
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run' 
thin (1.3.1) lib/thin/backends/base.rb:61:in `start' 
thin (1.3.1) lib/thin/server.rb:159:in `start' 
rack (1.4.1) lib/rack/handler/thin.rb:13:in `run' 
rack (1.4.1) lib/rack/server.rb:265:in `start' 
railties (3.2.3) lib/rails/commands/server.rb:70:in `start' 
railties (3.2.3) lib/rails/commands.rb:55:in `block in <top (required)>' 
railties (3.2.3) lib/rails/commands.rb:50:in `tap' 
railties (3.2.3) lib/rails/commands.rb:50:in `<top (required)>' 
script/rails:6:in `require' 
script/rails:6:in `<main>' 

回答

7

完全跟蹤你有沒有的ActionMailer SMTP設置任何地方定義?你可以把它們放在config/initializers/setup_mail.rb中。

爲setup_mail.rb

ActionMailer::Base.smtp_settings = { 
    :address => "smtp.mandrillapp.com", 
    :port  => 587, 
    :user_name => "MANDRILL_USERNAME", 
    :password => "MANDRILL_SMTP_PASS" 

} 

而且在你的config /環境/ production.rb:

config.action_mailer.delivery_method = :smtp 
    config.action_mailer.perform_deliveries = true 
    config.action_mailer.raise_delivery_errors = false 
    config.action_mailer.default :charset => "utf-8"