In Production mode on Heroku Devise's conformi

2019-08-03 17:24发布

问题:

for User Create & Authentication I used devise gem. Which is working perfectly in development mode in local machine. But when I try to perform sign up on heroku confirming mail can't sent.

Using ruby-2.0.0-p353 , Rails 4.1.1 , devise 3.3.0

Here is my code what I set.

config/environments/development.rb

Rails.application.configure do
  config.cache_classes = false
  config.eager_load = false
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false
  config.action_mailer.raise_delivery_errors = false
  config.active_support.deprecation = :log
  config.active_record.migration_error = :page_load
  config.assets.debug = true
  config.action_mailer.default :charset => "utf-8"
  config.assets.raise_runtime_errors = true
  config.action_mailer.default_url_options = { :host => 'localhost:3000' }
  config.action_mailer.delivery_method = :smtp

  config.action_mailer.smtp_settings = {
      address:              'smtp.gmail.com',
      port:                 587,
      domain:               'gmail.com',
      user_name:            'my_gmail_id@gmail.com',
      password:             'mygmail_password',
      authentication:       'plain',
      enable_starttls_auto: true  }

end

config/initializers/devise.rb

Devise.setup do |config|
 config.mailer_sender = 'my_gmail_id@gmail.com'
 config.mailer = 'Devise::Mailer'
 require 'devise/orm/active_record'
 config.case_insensitive_keys = [ :email ]
 config.strip_whitespace_keys = [ :email ]
 config.skip_session_storage = [:http_auth]
 config.stretches = Rails.env.test? ? 1 : 10
 config.reconfirmable = true
 config.expire_all_remember_me_on_sign_out = true
 config.password_length = 8..128
 config.reset_password_within = 6.hours
 config.sign_out_via = :delete
end

config/environments/production.rb

Rails.application.configure do
  config.cache_classes = true
  config.eager_load = true
  ....
  config.action_mailer.default_url_options = { :host => 'myapp.herokuapp.com' }
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.smtp_settings = {
    address: 'smtp.gmail.com',
    port: 587,
    domain: 'gmail.com',
    user_name: 'my_gmail_id@gmail.com',
    password: 'mygmail_password',
    authentication: 'plain',
    enable_starttls_auto: true }
end

Where do I mistake please point me. I have already tried as many Stack Overflow's answers but still not solved this issue. Is there any problem on heroku to send mail via SMTP? or Is there any special setting required??

Heroku's Latest Log after click on Signup button

2014-09-06T06:48:13.756842+00:00 app[web.1]: => Booting WEBrick
2014-09-06T06:48:13.797030+00:00 app[web.1]: sh: /usr/sbin/sendmail: not found
2014-09-06T06:48:13.756849+00:00 app[web.1]: => Rails 4.1.1 application starting in production on http://0.0.0.0:21502
2014-09-06T06:48:13.756853+00:00 app[web.1]: => Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
2014-09-06T06:48:13.756855+00:00 app[web.1]: => Ctrl-C to shutdown server
2014-09-06T06:48:14.174309+00:00 heroku[router]: at=info method=GET path="/" host=myapp.herokuapp.com request_id=388f2377-2fad-4037-96b1-eef5030be562 fwd="182.74.176.166" dyno=web.1 connect=2ms service=13ms status=302 bytes=1247
2014-09-06T06:48:14.481684+00:00 heroku[router]: at=info method=GET path="/users/sign_in" host=myapp.herokuapp.com request_id=ab6e0be6-f8a5-46f4-a6fc-57e2a73f5ca2 fwd="182.74.176.166" dyno=web.1 connect=0ms service=16ms status=200 bytes=1371
2014-09-06T06:48:14.833216+00:00 heroku[router]: at=info method=GET path="/assets/application-48345e63cf2df682255dab96ad27acc5.css" host=myapp.herokuapp.com request_id=6674d9b3-0e4d-4d24-8707-fab74033a762 fwd="182.74.176.166" dyno=web.1 connect=1ms service=5ms status=200 bytes=1142
2014-09-06T06:48:14.848893+00:00 heroku[router]: at=info method=GET path="/assets/application-9737ed55f72b58c2701f914dfe7a1231.js" host=myapp.herokuapp.com request_id=80169f38-89d7-415b-af71-187352243ec3 fwd="182.74.176.166" dyno=web.1 connect=1ms service=8ms status=200 bytes=1126
2014-09-06T06:48:17.705442+00:00 heroku[router]: at=info method=GET path="/assets/lang_arrow-3726918349ac40bab6e1d3bc05c0c024.png" host=myapp.herokuapp.com request_id=1e87561d-70ea-4a07-8be3-61f4e5edc7f6 fwd="182.74.176.166" dyno=web.1 connect=1ms service=7ms status=200 bytes=1136
2014-09-06T06:48:17.715978+00:00 heroku[router]: at=info method=GET path="/assets/ic_home-5eb9a6c895eec3a1d1afe6feff06a70d.png" host=myapp.herokuapp.com request_id=460e077c-1271-4555-84c6-e9d1f9450751 fwd="182.74.176.166" dyno=web.1 connect=0ms service=4ms status=200 bytes=1133
2014-09-06T06:48:17.700930+00:00 heroku[router]: at=info method=GET path="/assets/ic_blue_use-42ea0542433fa44fdaa200c3362c1e54.png" host=myapp.herokuapp.com request_id=3472c43a-0e69-4e2d-8589-3e897cab56a0 fwd="182.74.176.166" dyno=web.1 connect=1ms service=4ms status=200 bytes=1137
2014-09-06T06:48:17.746773+00:00 heroku[router]: at=info method=GET path="/assets/ic_pwd-24fdf7b9c435224ca949327a4253de43.png" host=myapp.herokuapp.com request_id=89759d8e-cd49-41f1-afd0-a8defebb09df fwd="182.74.176.166" dyno=web.1 connect=2ms service=7ms status=200 bytes=1132
2014-09-06T06:48:17.706910+00:00 heroku[router]: at=info method=GET path="/assets/logo1-2739445b7d155e432153465ea9b1051b.png" host=myapp.herokuapp.com request_id=c94bb0c3-7be7-4a7f-80db-400b4f81b14c fwd="182.74.176.166" dyno=web.1 connect=1ms service=3ms status=200 bytes=1131
2014-09-06T06:48:17.732645+00:00 heroku[router]: at=info method=GET path="/assets/ic_user-f60cef6628a5ad2519bc5501b7b37303.png" host=myapp.herokuapp.com request_id=946d07fa-9c4b-4fbe-bb1c-88900aa864ec fwd="182.74.176.166" dyno=web.1 connect=0ms service=3ms status=200 bytes=1133
2014-09-06T06:48:18.010596+00:00 heroku[router]: at=info method=GET path="/assets/ic_lang.png" host=myapp.herokuapp.com request_id=a3612759-9d19-4155-a3dd-af944ce8804d fwd="182.74.176.166" dyno=web.1 connect=1ms service=6ms status=200 bytes=1142
2014-09-06T06:48:18.171791+00:00 heroku[router]: at=info method=GET path="/assets/bottom_box_shedow.png" host=myapp.herokuapp.com request_id=960df91c-df6a-492e-b9d7-34b616350c82 fwd="182.74.176.166" dyno=web.1 connect=1ms service=6ms status=200 bytes=1152
2014-09-06T06:50:32+00:00 heroku[slug-compiler]: Slug compilation started
2014-09-06T06:50:41.363184+00:00 heroku[router]: at=info method=GET path="/users/sign_up" host=myapp.herokuapp.com request_id=ceed37ed-2039-4344-a295-ba70a3992125 fwd="182.74.176.166" dyno=web.1 connect=1ms service=19ms status=200 bytes=1069
2014-09-06T06:50:41.955994+00:00 heroku[router]: at=info method=GET path="/assets/application-9737ed55f72b58c2701f914dfe7a1231.js" host=myapp.herokuapp.com request_id=e610246f-fe29-4cc3-98b1-45ae7be9e737 fwd="182.74.176.166" dyno=web.1 connect=0ms service=12ms status=200 bytes=952
2014-09-06T06:50:41.954472+00:00 heroku[router]: at=info method=GET path="/assets/application-48345e63cf2df682255dab96ad27acc5.css" host=myapp.herokuapp.com request_id=f77cecea-4ef6-44d1-b8b8-c23258c85e52 fwd="182.74.176.166" dyno=web.1 connect=1ms service=6ms status=200 bytes=968
2014-09-06T06:50:44.754330+00:00 heroku[router]: at=info method=GET path="/assets/lang_arrow-3726918349ac40bab6e1d3bc05c0c024.png" host=myapp.herokuapp.com request_id=9512cf22-ec9f-4103-9dca-d7c19395b57c fwd="182.74.176.166" dyno=web.1 connect=2ms service=9ms status=200 bytes=962
2014-09-06T06:50:44.756381+00:00 heroku[router]: at=info method=GET path="/assets/ic_blue_use-42ea0542433fa44fdaa200c3362c1e54.png" host=myapp.herokuapp.com request_id=3bb129c3-efb7-4ffe-8ce9-fc55ef8980ea fwd="182.74.176.166" dyno=web.1 connect=1ms service=7ms status=200 bytes=963
2014-09-06T06:50:44.752882+00:00 heroku[router]: at=info method=GET path="/assets/logo1-2739445b7d155e432153465ea9b1051b.png" host=myapp.herokuapp.com request_id=ed6f1ac8-de0c-411f-96d3-0cc0152cb3e4 fwd="182.74.176.166" dyno=web.1 connect=1ms service=8ms status=200 bytes=957
2014-09-06T06:50:45.137468+00:00 heroku[router]: at=info method=GET path="/assets/ic_home-5eb9a6c895eec3a1d1afe6feff06a70d.png" host=myapp.herokuapp.com request_id=c8ffaf06-4366-4e51-bec1-4338e029d3c1 fwd="182.74.176.166" dyno=web.1 connect=1ms service=74ms status=200 bytes=959
2014-09-06T06:50:45.140658+00:00 heroku[router]: at=info method=GET path="/assets/bottom_box_shedow.png" host=myapp.herokuapp.com request_id=969e6034-df02-4052-9e58-7ad24f488098 fwd="182.74.176.166" dyno=web.1 connect=1ms service=76ms status=200 bytes=978
2014-09-06T06:50:45.139103+00:00 heroku[router]: at=info method=GET path="/assets/ic_lang.png" host=myapp.herokuapp.com request_id=33e32985-c96b-46b6-a509-5cb2e3879972 fwd="182.74.176.166" dyno=web.1 connect=1ms service=74ms status=200 bytes=968
2014-09-06T06:50:59+00:00 heroku[slug-compiler]: Slug compilation finished
2014-09-06T06:50:59.120074+00:00 heroku[api]: Deploy 182fc29 by myherokuid@example.com
2014-09-06T06:50:59.120141+00:00 heroku[api]: Release v34 created by myherokuid@example.com
2014-09-06T06:50:59.242867+00:00 heroku[web.1]: State changed from up to starting
2014-09-06T06:51:01.575987+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-09-06T06:51:02.136903+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `select'
2014-09-06T06:51:02.136912+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
2014-09-06T06:51:02.136920+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
2014-09-06T06:51:02.137129+00:00 app[web.1]: [2014-09-06 06:51:02] INFO  WEBrick::HTTPServer#start done.
2014-09-06T06:51:02.136906+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `block in start'
2014-09-06T06:51:02.136913+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands/server.rb:69:in `start'
2014-09-06T06:51:02.136921+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands.rb:17:in `<top (required)>'
2014-09-06T06:51:02.211217+00:00 app[web.1]: Exiting
2014-09-06T06:51:02.136896+00:00 app[web.1]: [2014-09-06 06:51:02] FATAL SignalException: SIGTERM
2014-09-06T06:51:02.136910+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:14:in `run'
2014-09-06T06:51:02.136918+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:76:in `server'
2014-09-06T06:51:02.137041+00:00 app[web.1]: [2014-09-06 06:51:02] INFO  going to shutdown ...
2014-09-06T06:51:02.639632+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 51499 -e production`
2014-09-06T06:51:03.107653+00:00 heroku[web.1]: Process exited with status 143
2014-09-06T06:51:02.136907+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:32:in `start'
2014-09-06T06:51:02.136915+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:81:in `block in server'
2014-09-06T06:51:02.136923+00:00 app[web.1]:    bin/rails:8:in `require'
2014-09-06T06:51:02.136909+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:160:in `start'
2014-09-06T06:51:02.136917+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:76:in `tap'
2014-09-06T06:51:02.136925+00:00 app[web.1]:    bin/rails:8:in `<main>'
2014-09-06T06:51:06.524264+00:00 app[web.1]: [2014-09-06 06:51:06] INFO  WEBrick 1.3.1
2014-09-06T06:51:06.524289+00:00 app[web.1]: [2014-09-06 06:51:06] INFO  ruby 2.0.0 (2014-05-08) [x86_64-linux]
2014-09-06T06:51:06.524724+00:00 app[web.1]: [2014-09-06 06:51:06] INFO  WEBrick::HTTPServer#start: pid=2 port=51499
2014-09-06T06:51:06.662354+00:00 heroku[web.1]: State changed from starting to up
2014-09-06T06:51:23.329820+00:00 heroku[router]: at=info method=GET path="/users/sign_up" host=myapp.herokuapp.com request_id=19fcdeb0-308c-4fcc-90a2-baa520c21de2 fwd="182.74.176.166" dyno=web.1 connect=2ms service=447ms status=200 bytes=895
2014-09-06T06:51:23.683160+00:00 heroku[router]: at=info method=GET path="/assets/application-9737ed55f72b58c2701f914dfe7a1231.js" host=myapp.herokuapp.com request_id=ad05eecf-eabd-4538-9614-e63afd5b75f4 fwd="182.74.176.166" dyno=web.1 connect=0ms service=19ms status=200 bytes=952
2014-09-06T06:51:23.664871+00:00 heroku[router]: at=info method=GET path="/assets/application-48345e63cf2df682255dab96ad27acc5.css" host=myapp.herokuapp.com request_id=f9f113e8-92ce-44d7-9c16-8f788c9af2c9 fwd="182.74.176.166" dyno=web.1 connect=1ms service=7ms status=200 bytes=968
2014-09-06T06:51:26.460696+00:00 heroku[router]: at=info method=GET path="/assets/ic_blue_use-42ea0542433fa44fdaa200c3362c1e54.png" host=myapp.herokuapp.com request_id=7a9280a0-383a-49b5-a2af-5be986566e76 fwd="182.74.176.166" dyno=web.1 connect=1ms service=6ms status=200 bytes=963
2014-09-06T06:51:26.465890+00:00 heroku[router]: at=info method=GET path="/assets/lang_arrow-3726918349ac40bab6e1d3bc05c0c024.png" host=myapp.herokuapp.com request_id=f5f2ec34-7bca-44df-a163-000e53436504 fwd="182.74.176.166" dyno=web.1 connect=1ms service=12ms status=200 bytes=962
2014-09-06T06:51:26.475100+00:00 heroku[router]: at=info method=GET path="/assets/ic_home-5eb9a6c895eec3a1d1afe6feff06a70d.png" host=myapp.herokuapp.com request_id=8d3a0f1f-fe6d-47fa-a0b3-79e3900b08b4 fwd="182.74.176.166" dyno=web.1 connect=1ms service=9ms status=200 bytes=959
2014-09-06T06:51:26.468458+00:00 heroku[router]: at=info method=GET path="/assets/logo1-2739445b7d155e432153465ea9b1051b.png" host=myapp.herokuapp.com request_id=ab70c12b-792d-4296-bed3-861991390560 fwd="182.74.176.166" dyno=web.1 connect=0ms service=8ms status=200 bytes=957
2014-09-06T06:51:26.509971+00:00 heroku[router]: at=info method=GET path="/assets/bottom_box_shedow.png" host=myapp.herokuapp.com request_id=0a0eee8c-08e7-4894-ba50-b3643cfade38 fwd="182.74.176.166" dyno=web.1 connect=1ms service=21ms status=200 bytes=978
2014-09-06T06:51:26.494661+00:00 heroku[router]: at=info method=GET path="/assets/ic_lang.png" host=myapp.herokuapp.com request_id=20620263-c241-409d-bcc0-a7e25be6658f fwd="182.74.176.166" dyno=web.1 connect=1ms service=17ms status=200 bytes=968
2014-09-06T06:54:04.602299+00:00 heroku[router]: at=info method=POST path="/users" host=myapp.herokuapp.com request_id=5750cd98-6521-47b7-8293-8f3f60487325 fwd="182.74.176.166" dyno=web.1 connect=1ms service=1215ms status=500 bytes=1356
2014-09-06T07:56:24.562965+00:00 heroku[web.1]: Idling
2014-09-06T07:56:24.563494+00:00 heroku[web.1]: State changed from up to down
2014-09-06T07:56:27.358380+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:32:in `start'
2014-09-06T07:56:27.358370+00:00 app[web.1]: [2014-09-06 07:56:27] FATAL SignalException: SIGTERM
2014-09-06T07:56:27.358378+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `block in start'
2014-09-06T07:56:27.358410+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:14:in `run'
2014-09-06T07:56:27.358413+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands/server.rb:69:in `start'
2014-09-06T07:56:27.358417+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:76:in `tap'
2014-09-06T07:56:27.358376+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `select'
2014-09-06T07:56:27.358408+00:00 app[web.1]:    /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:160:in `start'
2014-09-06T07:56:27.358412+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
2014-09-06T07:56:27.358423+00:00 app[web.1]:    bin/rails:8:in `require'
2014-09-06T07:56:27.358418+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:76:in `server'
2014-09-06T07:56:27.358586+00:00 app[web.1]: [2014-09-06 07:56:27] INFO  WEBrick::HTTPServer#start done.
2014-09-06T07:56:27.358424+00:00 app[web.1]:    bin/rails:8:in `<main>'
2014-09-06T07:56:27.358510+00:00 app[web.1]: [2014-09-06 07:56:27] INFO  going to shutdown ...
2014-09-06T07:56:27.358415+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:81:in `block in server'
2014-09-06T07:56:27.393017+00:00 app[web.1]: => Rails 4.1.1 application starting in production on http://0.0.0.0:51499
2014-09-06T07:56:27.393021+00:00 app[web.1]: => Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
2014-09-06T07:56:27.358421+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands.rb:17:in `<top (required)>'
2014-09-06T07:56:27.358420+00:00 app[web.1]:    /app/vendor/bundle/ruby/2.0.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
2014-09-06T07:56:27.393010+00:00 app[web.1]: => Booting WEBrick
2014-09-06T07:56:27.393019+00:00 app[web.1]: => Run `rails server -h` for more startup options
2014-09-06T07:56:27.393024+00:00 app[web.1]: Exiting
2014-09-06T07:56:27.393023+00:00 app[web.1]: => Ctrl-C to shutdown server
2014-09-06T07:56:26.834911+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-09-06T07:56:28.211024+00:00 heroku[web.1]: Process exited with status 143
2014-09-06T08:12:20.238449+00:00 heroku[web.1]: State changed from down to starting
2014-09-06T08:12:20.238449+00:00 heroku[web.1]: Unidling
2014-09-06T08:12:23.775242+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 9281 -e production`
2014-09-06T08:12:27.222560+00:00 app[web.1]: [2014-09-06 08:12:27] INFO  WEBrick 1.3.1
2014-09-06T08:12:27.223057+00:00 app[web.1]: [2014-09-06 08:12:27] INFO  WEBrick::HTTPServer#start: pid=2 port=9281
2014-09-06T08:12:27.222588+00:00 app[web.1]: [2014-09-06 08:12:27] INFO  ruby 2.0.0 (2014-05-08) [x86_64-linux]
2014-09-06T08:12:27.659363+00:00 heroku[web.1]: State changed from starting to up
2014-09-06T08:12:29.901156+00:00 heroku[router]: at=info method=POST path="/users" host=myapp.herokuapp.com request_id=cca41a60-a02a-451e-b277-22bc155ebed0 fwd="182.74.176.166" dyno=web.1 connect=1ms service=1599ms status=500 bytes=1359

回答1:

/usr/sbin/sendmail: not found

This means that your linux installation doesn't have the sendmail package installed

If you were on a VPS, I'd recommend you install the sendmail package by using sudo apt-get install sendmail. However, as you're on Heroku, I'd question as to whether this would be the issue itself.


Devise

Not seeing any other errors, I would recommend doing the following:

  1. Change SMTP to third-party provider (Sendgrid of Mandrill)
  2. Test to see if "not" sending the email will help the signup process
  3. See if the user is created in the database

Surprisingly, I'll start with #3 first - I am guestimating that the user is being created, it's just they can't be sent. I don't know this for sure (the logs are not conclusive), so I'd prefer to see whether the user objects are being created:

$ heroku run rails c
$ user = User.last
 [user credentials displayed]

This will give you the ability to see the last entry into the users table. If the entry is what you've submitted, it will further support my ideas that the email system isn't working for some reason.

--

Next, you need to ensure you mail settings are correct. To do this, you can use the following add-ons (recommend Mandrill):

#config/environments/production.rb
config.action_mailer.smtp_settings = {
        :address   => "smtp.mandrillapp.com",
        :port      => 25, # ports 587 and 2525 are also supported with STARTTLS
        :enable_starttls_auto => true, # detects and uses STARTTLS
        :user_name => ENV["MANDRILL_USERNAME"],
        :password  => ENV["MANDRILL_PASSWORD"], # SMTP password is any valid API key
        :authentication => 'login', # Mandrill supports 'plain' or 'login'
        :domain => 'yourdomain.com', # your domain to identify your server when connecting
}

Remove the default_url_option and delivery_method settings

--

Finally, it seems the core of your issues is going to be the sending of an email.

I am presuming this to be a confirmation email, which you can disable with Devise. I have never done this before, so here is a reference for you:

user = User.new
user.skip_confirmation!


回答2:

Hey Thanks a lots to @Rich Peck and @Mandeep for there efforts. I have solved the issue now.. by putting more effort on searching. I have just added one line and it works..

config.action_mailer.smtp_settings = {
      address: 'smtp.gmail.com',
      port: 587,
      domain: 'gmail.com',
      user_name: 'mygmail_id@gmail.com',
      password: 'mygmail_password',
      authentication: 'plain',
      enable_starttls_auto: true,
      :openssl_verify_mode => 'none'  # This line added and it works fine
}