algobasket / PeatioCryptoExchange

An open-source Crypto-Currency exchange. Peatio v3.0 Coming Soon !
https://www.peatio.info
187 stars 205 forks source link

Don'r receive activation email #17

Open elielbeck opened 6 years ago

elielbeck commented 6 years ago

Hi! I`ve installed correctly on production mode but don't receive activation email after signup:

log/production.log:

I, [2018-11-11T18:01:21.629469 #7306] INFO -- : Redirected to http://kryptobitmarket.com/settings I, [2018-11-11T18:01:21.629913 #7306] INFO -- : Completed 302 Found in 115ms (ActiveRecord: 31.7ms) I, [2018-11-11T18:01:21.631690 #27683] INFO -- : Rendered token_mailer/activation.html.erb within layouts/mailers/application (0.8ms) I, [2018-11-11T18:01:21.640511 #27683] INFO -- : Sent mail to etnobox@gmail.com (6.5ms) I, [2018-11-11T18:01:21.702549 #7306] INFO -- : Started GET "/settings" for 47.63.217.156 at 2018-11-11 18:01:21 +0100 I, [2018-11-11T18:01:21.704791 #7306] INFO -- : Processing by Private::SettingsController#index as HTML I, [2018-11-11T18:01:21.748268 #7306] INFO -- : Rendered private/settings/index.html.slim within layouts/application (27.8ms)

ghaseminya commented 5 years ago

Hi, I Have same issue too... I worked on this problem for about 10 days! but did not found any solution. @algobasket

ghaseminya commented 5 years ago

I run this script in ruby console, and send mail successfully, but activation mail not work...

cd PeatioCryptoExchange

./bin/rails console

mailer = ActionMailer::Base

mailer.delivery_method # -> :smtp

mailer.smtp_settings # -> { address: "smtp.test.com", port: 25, domain: "test.com", user_name: "admin", password: "*****", authentication: "plain", enable_starttls_auto: false }

mailer.mail(from: 'admin@test.com', to: 'mohammad.ghasemy@gmail.com', subject: 'test', body: "Hello, you've got mail!").deliver This email id is registered in DirectAdmin panel with own .com domain and work correctly.

ghaseminya commented 5 years ago
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.default_url_options = { host: ENV["URL_HOST"], protocol: ENV['URL_SCHEMA'] }
  config.action_mailer.perform_deliveries = true
  config.action_mailer.default :charset => "utf-8"
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    port:           ENV["SMTP_PORT"],
    domain:         ENV["SMTP_DOMAIN"],
    address:        ENV["SMTP_ADDRESS"],
    user_name:      ENV["SMTP_USERNAME"],
    password:       ENV["SMTP_PASSWORD"],
    authentication: ENV["SMTP_AUTHENTICATION"],
    enable_starttls_auto: false
  }
ghaseminya commented 5 years ago

I installed mail module too... gem install mail

ghaseminya commented 5 years ago

This is output of ruby server on debug mode, when i click "Send it again" button in /settings or profile page for resend veriffication mail:

 bundle exec rails server -b 0.0.0.0 
=> Booting WEBrick
=> Rails 4.0.12 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2019-06-04 01:13:09] INFO  WEBrick 1.3.1
[2019-06-04 01:13:09] INFO  ruby 2.2.7 (2017-03-28) [x86_64-linux]
[2019-06-04 01:13:09] INFO  WEBrick::HTTPServer#start: pid=10499 port=3000
I, [2019-06-04T01:13:14.845985 #10499]  INFO -- : Started GET "/activations/new" for 127.0.0.1 at 2019-06-04 01:13:14 +0430
I, [2019-06-04T01:13:14.881290 #10499]  INFO -- : Processing by ActivationsController#new as HTML
D, [2019-06-04T01:13:14.885129 #10499] DEBUG -- :   Member Load (0.2ms)  SELECT `members`.* FROM `members` WHERE `members`.`disabled` = 0 AND `members`.`id` = 2 ORDER BY `members`.`id` ASC LIMIT 1
D, [2019-06-04T01:13:14.898608 #10499] DEBUG -- :   Account Load (0.2ms)  SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`member_id` = 2
D, [2019-06-04T01:13:14.906069 #10499] DEBUG -- :    (0.1ms)  BEGIN
D, [2019-06-04T01:13:14.912948 #10499] DEBUG -- :   Token::Activation Load (0.3ms)  SELECT `tokens`.* FROM `tokens` WHERE `tokens`.`type` IN ('Token::Activation') AND (expire_at > '2019-06-04 01:13:14' and is_used = 0) AND `tokens`.`member_id` = 2 ORDER BY `tokens`.`created_at` DESC LIMIT 1
D, [2019-06-04T01:13:14.914258 #10499] DEBUG -- :    (0.1ms)  ROLLBACK
I, [2019-06-04T01:13:14.914729 #10499]  INFO -- : Redirected to http://*********.com/settings
I, [2019-06-04T01:13:14.914856 #10499]  INFO -- : Completed 302 Found in 33ms (ActiveRecord: 2.9ms)
I, [2019-06-04T01:13:15.079231 #10499]  INFO -- : Started GET "/settings" for 127.0.0.1 at 2019-06-04 01:13:15 +0430
I, [2019-06-04T01:13:15.081563 #10499]  INFO -- : Processing by Private::SettingsController#index as HTML
D, [2019-06-04T01:13:15.082808 #10499] DEBUG -- :   Member Load (0.2ms)  SELECT `members`.* FROM `members` WHERE `members`.`disabled` = 0 AND `members`.`id` = 2 ORDER BY `members`.`id` ASC LIMIT 1
D, [2019-06-04T01:13:15.087148 #10499] DEBUG -- :    (0.2ms)  SELECT SUM(`trades`.`volume`) AS sum_id FROM `trades` WHERE `trades`.`currency` = 3 AND (created_at > '2019-06-03 01:13:15')
D, [2019-06-04T01:13:15.090065 #10499] DEBUG -- :    (0.1ms)  SELECT SUM(`trades`.`volume`) AS sum_id FROM `trades` WHERE `trades`.`currency` = 4 AND (created_at > '2019-06-03 01:13:15')
D, [2019-06-04T01:13:15.090891 #10499] DEBUG -- :    (0.1ms)  SELECT SUM(`trades`.`volume`) AS sum_id FROM `trades` WHERE `trades`.`currency` = 5 AND (created_at > '2019-06-03 01:13:15')
D, [2019-06-04T01:13:15.091646 #10499] DEBUG -- :   Account Load (0.1ms)  SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`member_id` = 2
D, [2019-06-04T01:13:15.111491 #10499] DEBUG -- :   IdDocument Load (0.2ms)  SELECT `id_documents`.* FROM `id_documents` WHERE `id_documents`.`member_id` = 2 LIMIT 1
D, [2019-06-04T01:13:15.118815 #10499] DEBUG -- :   TwoFactor Load (0.1ms)  SELECT `two_factors`.* FROM `two_factors` WHERE `two_factors`.`member_id` = 2 AND `two_factors`.`type` = 'TwoFactor::Sms' LIMIT 1
D, [2019-06-04T01:13:15.126098 #10499] DEBUG -- :   TwoFactor Load (0.2ms)  SELECT `two_factors`.* FROM `two_factors` WHERE `two_factors`.`member_id` = 2 AND `two_factors`.`type` = 'TwoFactor::App' LIMIT 1
D, [2019-06-04T01:13:15.132198 #10499] DEBUG -- :   Authentication Load (0.2ms)  SELECT `authentications`.* FROM `authentications` WHERE `authentications`.`member_id` = 2 AND `authentications`.`provider` = 'identity' LIMIT 1
D, [2019-06-04T01:13:15.137612 #10499] DEBUG -- :   Identity Load (0.1ms)  SELECT `identities`.* FROM `identities` WHERE `identities`.`id` = 2 LIMIT 1
D, [2019-06-04T01:13:15.151739 #10499] DEBUG -- :   ActsAsTaggableOn::Tag Load (0.2ms)  SELECT `tags`.* FROM `tags` INNER JOIN `taggings` ON `tags`.`id` = `taggings`.`tag_id` WHERE `taggings`.`taggable_id` = 2 AND `taggings`.`taggable_type` = 'Member' AND (taggings.context = 'tags' AND taggings.tagger_id IS NULL)
I, [2019-06-04T01:13:15.152034 #10499]  INFO -- :   Rendered private/settings/index.html.slim within layouts/application (58.2ms)
I, [2019-06-04T01:13:15.158633 #10499]  INFO -- :   Rendered shared/_html5.html.slim (1.3ms)
I, [2019-06-04T01:13:15.161214 #10499]  INFO -- :   Rendered shared/_meta.html.slim (2.3ms)
I, [2019-06-04T01:13:15.164755 #10499]  INFO -- :   Rendered shared/_alert.html.slim (3.0ms)
D, [2019-06-04T01:13:15.176315 #10499] DEBUG -- :   Ticket Load (0.2ms)  SELECT `tickets`.* FROM `tickets` WHERE `tickets`.`author_id` = 2 AND `tickets`.`aasm_state` = 'open'
D, [2019-06-04T01:13:15.183589 #10499] DEBUG -- :   ReadMark Load (0.2ms)  SELECT `read_marks`.* FROM `read_marks` WHERE `read_marks`.`member_id` = 2 AND `read_marks`.`readable_type` = 'Comment' AND `read_marks`.`readable_id` IS NULL ORDER BY `read_marks`.`id` ASC LIMIT 1
D, [2019-06-04T01:13:15.186124 #10499] DEBUG -- :   Comment Load (0.2ms)  SELECT `comments`.* FROM `comments` LEFT JOIN read_marks as read_marks ON read_marks.readable_type = 'Comment'
 AND read_marks.readable_id = comments.id
 AND read_marks.member_id = 2
 AND read_marks.timestamp >= comments.created_at WHERE `comments`.`ticket_id` IN (1) AND (author_id <> 2) AND (read_marks.id IS NULL) AND (comments.created_at > '2019-05-29 00:16:27')
D, [2019-06-04T01:13:15.186732 #10499] DEBUG -- :   CACHE (0.0ms)  SELECT `tickets`.* FROM `tickets` WHERE `tickets`.`author_id` = 2 AND `tickets`.`aasm_state` = 'open'  [["author_id", 2]]
D, [2019-06-04T01:13:15.187244 #10499] DEBUG -- :   CACHE (0.0ms)  SELECT `comments`.* FROM `comments` LEFT JOIN read_marks as read_marks ON read_marks.readable_type = 'Comment'
 AND read_marks.readable_id = comments.id
 AND read_marks.member_id = 2
 AND read_marks.timestamp >= comments.created_at WHERE `comments`.`ticket_id` IN (1) AND (author_id <> 2) AND (read_marks.id IS NULL) AND (comments.created_at > '2019-05-29 00:16:27')
I, [2019-06-04T01:13:15.188213 #10499]  INFO -- :   Rendered shared/_header_profile_setting.html.slim (19.8ms)
I, [2019-06-04T01:13:15.191411 #10499]  INFO -- :   Rendered shared/_header_lang_sel.html.slim (2.7ms)
I, [2019-06-04T01:13:15.191467 #10499]  INFO -- :   Rendered shared/_header.html.slim (26.5ms)
I, [2019-06-04T01:13:15.199600 #10499]  INFO -- :   Rendered shared/_flash.slim (4.2ms)
I, [2019-06-04T01:13:15.199684 #10499]  INFO -- :   Rendered shared/_frame.html.slim (8.0ms)
I, [2019-06-04T01:13:15.216036 #10499]  INFO -- :   Rendered shared/_footer.html.slim (16.1ms)
I, [2019-06-04T01:13:15.216227 #10499]  INFO -- : Completed 200 OK in 135ms (Views: 118.1ms | ActiveRecord: 7.2ms)
ghaseminya commented 5 years ago

This log show that mail.delivery method don't call, because if called any it must send a result(error or success message).

I check app/mailers/base_mailer.rb but didn't have any problem.

./bin/rails -v Rails 4.0.12 rbenv global 2.2.7 bundle -v Bundler version 1.9.2

pankaj9310 commented 5 years ago

@ghaseminya Check your worker is not running start using below command bundle exec rake daemons:start check log file of notification worker

ghaseminya commented 5 years ago

@pankaj9310 No, this is not correct answer, Worker is running up... I run this command: bundle exec rake daemons:start run before start server.

pankaj9310 commented 5 years ago

@ghaseminya share log of notification worker

ghaseminya commented 5 years ago

I must add ".log" extension on all files for upload it!

ghaseminya commented 5 years ago

withdraw_audit.rb.pid.log peatio:amqp:matching.pid.log peatio:amqp:deposit_coin.pid.log withdraw_audit.rb.output.log global_state.rb.pid.log global_state.rb.output.log peatio:amqp:withdraw_coin.pid.log peatio:amqp:order_processor:1.pid.log k.rb.output.log k.rb.pid.log peatio:amqp:matching.output.log peatio:amqp:deposit_coin.output.log stats.rb.pid.log websocket_api.rb.pid.log hot_wallets.rb.pid.log hot_wallets.rb.output.log peatio:amqp:trade_executor:1.pid.log peatio:amqp:withdraw_coin.output.log peatio:amqp:market_data.pid.log peatio:amqp:notification.pid.log peatio:amqp:pusher:1.pid.log peatio:amqp:trade_executor:1.output.log payment_transaction.rb.output.log payment_transaction.rb.pid.log peatio:amqp:pusher:1.output.log peatio:amqp:market_data.output.log websocket_api.rb.output.log peatio:amqp:notification.output.log stats.rb.output.log peatio:amqp:order_processor:1.output.log production.log.log

pankaj9310 commented 5 years ago
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.default_url_options = { host: ENV["URL_HOST"], protocol: ENV['URL_SCHEMA'] }
  config.action_mailer.perform_deliveries = true
  config.action_mailer.default :charset => "utf-8"
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    port:           ENV["SMTP_PORT"],
    domain:         ENV["SMTP_DOMAIN"],
    address:        ENV["SMTP_ADDRESS"],
    user_name:      ENV["SMTP_USERNAME"],
    password:       ENV["SMTP_PASSWORD"],
    authentication: ENV["SMTP_AUTHENTICATION"],
    enable_starttls_auto: false
  }

peatio:amqp:notification: process with pid 5017 started. I, [2019-06-04T21:14:01.957427 #5017] INFO -- : Connected to AMQP broker (prefetch: default)

check below please add host parameter I, [2019-06-04T22:28:30.905667 #5017] INFO -- : Received: {"mailer_class":"TokenMailer","method":"activation","args":["ghaseminya@gmail.com","bdcdcd5ebd89a99e3b1ec0a818c48056"],"locale":"en"} F, [2019-06-04T22:28:30.907904 #5017] FATAL -- : Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true (ArgumentError)

ghaseminya commented 5 years ago

I commented host parameter in production.rb line for some test. Now uncomment and restart server(reboot vps and remove all log files) That error not occur, but stile email don't send! withdraw_audit.rb.pid.log peatio:amqp:matching.pid.log peatio:amqp:withdraw_coin.pid.log peatio:amqp:deposit_coin.pid.log withdraw_audit.rb.output.log global_state.rb.output.log k.rb.pid.log k.rb.output.log global_state.rb.pid.log peatio:amqp:order_processor:1.pid.log stats.rb.pid.log websocket_api.rb.pid.log hot_wallets.rb.pid.log hot_wallets.rb.output.log peatio:amqp:trade_executor:1.pid.log peatio:amqp:deposit_coin.output.log peatio:amqp:matching.output.log peatio:amqp:market_data.pid.log peatio:amqp:withdraw_coin.output.log peatio:amqp:notification.pid.log peatio:amqp:pusher:1.pid.log payment_transaction.rb.output.log payment_transaction.rb.pid.log websocket_api.rb.output.log peatio:amqp:trade_executor:1.output.log peatio:amqp:notification.output.log peatio:amqp:pusher:1.output.log peatio:amqp:market_data.output.log stats.rb.output.log peatio:amqp:order_processor:1.output.log production.log.log

ghaseminya commented 5 years ago

@algobasket Is there any solution for this problem?(or my configuration is wrong?)