1

嗨,我开始调整我的设计 gem,我发现了一个问题

当我点击链接 - >“忘记密码?”

比我输入电子邮件并单击“发送”

理想情况下,我应该收到带有链接的邮件.. 但我没有收到这封邮件

在控制台日志中我看到:

Started POST "/users/password" for 127.0.0.1 at 2012-08-27 10:42:30 +0300
Processing by Devise::PasswordsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"E7957iR69EDbZArYyaA8tGRmtuwr6LOM+lf7geAitZU=", "user"=>{"email"=>"...@gmail.com"}, "commit"=>"Send me reset password instructions"}
  User Load (0.4ms)  SELECT "users".* FROM "users" WHERE "users"."email" = '...@gmail.com' LIMIT 1
  User Load (0.3ms)  SELECT "users".* FROM "users" WHERE "users"."reset_password_token" = 'K8XfKY4RV2ZJKHzXShj7' LIMIT 1
   (0.1ms)  begin transaction
   (1.0ms)  UPDATE "users" SET "reset_password_token" = 'K8XfKY4RV2ZJKHzXShj7', "reset_password_sent_at" = '2012-08-27 07:42:30.170634', "updated_at" = '2012-08-27 07:42:30.171855' WHERE "users"."id" = 1
   (174.2ms)  commit transaction
  Rendered devise/mailer/reset_password_instructions.html.erb (1.6ms)

Sent mail to ...@gmail.com (1062ms)
Date: Mon, 27 Aug 2012 10:42:31 +0300
from: from localhost:3000 <local@gmail.com>
reply-to: from localhost:3000 <local@gmail.com>
To: ...@gmail.com
Message-ID: <503b24e732409_2f9224e7fbbe307c2@demitriydn.mail>
Subject: Reset password instructions
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

<p>Hello ...@gmail.com!</p>

<p>Someone has requested a link to change your password, and you can do this through the link below.</p>

<p><a href="http://localhost:3000/users/password/edit?reset_password_token=K8XfKY4RV2ZJKHzXShj7">Change my password</a></p>

<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>

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


Started GET "/users/sign_in" for 127.0.0.1 at 2012-08-27 10:42:32 +0300
Processing by Devise::SessionsController#new as HTML
  Rendered devise/shared/_links.erb (1.0ms)
  Rendered devise/sessions/new.html.erb within layouts/application (6.5ms)
Completed 200 OK in 21ms (Views: 19.6ms | ActiveRecord: 0.0ms)

<a href="http我从日志中复制链接 => // // 一切正常

我犯了什么错误?

根据日志,我收到了一封信...但是在“...@gmail.com”没有收到

4

2 回答 2

1

您是否尝试在生产环境中发送它?我有同样的问题,当我在开发环境中时它会显示在日志中,但我实际上不会收到电子邮件。但是,在生产环境中它运行良好。抱歉,这不是一个有用的答案,但我无法发表评论。

于 2012-08-27T13:37:06.520 回答
1

至于开发邮件事件,您可能需要在 development.rb 中设置 smtp 设置

确保您完整阅读此内容以完全理解邮件

http://guides.rubyonrails.org/action_mailer_basics.html

学习愉快

于 2012-08-27T08:55:21.867 回答