2015-01-30 6 views
0

Windows 컴퓨터에서 Rails 3.2 및 Ruby 4를 사용하고 있습니다. Devise gem의 확인 측면을 설정하려고합니다. 보석이 제대로 작동하고 있습니다. http://railsapps.github.io/rails-environment-variables.html에서 확인 이메일을 실제로 보내려면 이메일 계정을 설정해야합니다. 따라서 임시 Gmail 계정을 설정했습니다. production.rb 및 test.rb 환경에서 다음을 추가했습니다.devits gem에서 확인을 설정하려고합니다.

config.action_mailer.smtp_settings = { 
    address: "smtp.gmail.com", 
    port: 587, 
    domain: "example.com", 
    authentication: "plain", 
    enable_starttls_auto: true, 
    user_name: ENV["[email protected]"], 
    password: ENV["xxx"] 
    } 

실제로 앱을 배포하지 않았으며 localhost에서 작업하고 있습니다. 나는 이미 이메일 주소로 등록하려했지만 확인 메일을받지 못했습니다. 따라서 위의 설정을 완료 한 후 앱에 확인 지시를 다시 보내달라고 요청했습니다. 그러나 확인 이메일은 여전히 ​​도착하지 않았습니다 (스팸 폴더에도 없음).

Started POST "https://stackoverflow.com/users/confirmation" for 127.0.0.1 at 2015-01-30 19:57:29 +0100 
Processing by Devise::ConfirmationsController#create as HTML 
    Parameters: {"utf8"=>"V", "authenticity_token"=>"uqVdcfPNDiDw/BGxHQFCxQf9+IZDJs0fOgpHc1hbMDw=", "user"=>{"email"=>" 
[email protected]"}, "commit"=>"Resend confirmation instructions"} 
    User Load (1.0ms) SELECT `users`.* FROM `users` WHERE `users`.`unconfirmed_email` = '[email protected]' LIMIT 1 
    User Load (1.0ms) SELECT `users`.* FROM `users` WHERE `users`.`email` = '[email protected]' LIMIT 1 
    User Load (1.0ms) SELECT `users`.* FROM `users` WHERE `users`.`confirmation_token` = 'a6f9b9d801276572386b15945ff8 
925c7f975c3958f3e2b3dfdd03ff3ba4de88' LIMIT 1 
    (0.0ms) BEGIN 
    (1.0ms) UPDATE `users` SET `confirmation_token` = 'a6f9b9d801276572386b15945ff8925c7f975c3958f3e2b3dfdd03ff3ba4de 
88', `confirmation_sent_at` = '2015-01-30 18:57:30', `updated_at` = '2015-01-30 18:57:30' WHERE `users`.`id` = 1 
    (54.7ms) COMMIT 
    Rendered devise/mailer/confirmation_instructions.html.erb (2.0ms) 

Sent mail to [email protected] (521ms) 
Date: Fri, 30 Jan 2015 19:57:32 +0100 
From: [email protected] 
Reply-To: [email protected] 
To: [email protected] 
Message-ID: <[email protected]> 
Subject: Confirmation instructions 
Mime-Version: 1.0 
Content-Type: text/html; 
charset=UTF-8 
Content-Transfer-Encoding: 7bit 

<p>Welcome [email protected]!</p> 

<p>You can confirm your account email through the link below:</p> 

<p><a href="http://localhost:3000/users/confirmation?confirmation_token=m6vs52qoWGFX1pM6bqss">Confirm my account</a>< 
/p> 

Redirected to http://localhost:3000/users/sign_in 
Completed 302 Found in 3113ms (ActiveRecord: 0.0ms) 

어떤 도움이 아주 많이 감사합니다 :

서버

는 다음과 말했다.

답변

0

나는 그것이 작동하도록했습니다.

user_name: ENV["[email protected]"], 
password: ENV["xxx"] 

이 있어야한다 : 실수는 production.rb 및 test.rb했다

user_name: "[email protected]", 
password: "xxx"