Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 在Rails 4和Desive中使用邮件收集器_Ruby On Rails_Ruby_Devise_Mailcatcher - Fatal编程技术网

Ruby on rails 在Rails 4和Desive中使用邮件收集器

Ruby on rails 在Rails 4和Desive中使用邮件收集器,ruby-on-rails,ruby,devise,mailcatcher,Ruby On Rails,Ruby,Devise,Mailcatcher,提前感谢您的帮助 我在dev中使用Mailcatcher查看我的应用程序发送的电子邮件的外观,但在Mailcatcher界面中没有看到任何内容 以下是我目前掌握的情况: config/environment/development.rb config.action_mailer.default_url_options = { :host => 'localhost: 3000' } config.action_mailer.delivery_method = :smtp conf

提前感谢您的帮助

我在dev中使用Mailcatcher查看我的应用程序发送的电子邮件的外观,但在Mailcatcher界面中没有看到任何内容

以下是我目前掌握的情况:

config/environment/development.rb

 config.action_mailer.default_url_options =  { :host  => 'localhost: 3000' }
 config.action_mailer.delivery_method = :smtp
 config.action_mailer.smtp_settings = { address: '127.0.0.1', :port => 1025 }
class User < ActiveRecord::Base

  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable, :confirmable,
         :recoverable, :rememberable, :trackable, :validatable

end
型号/用户.rb

 config.action_mailer.default_url_options =  { :host  => 'localhost: 3000' }
 config.action_mailer.delivery_method = :smtp
 config.action_mailer.smtp_settings = { address: '127.0.0.1', :port => 1025 }
class User < ActiveRecord::Base

  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable, :confirmable,
         :recoverable, :rememberable, :trackable, :validatable

end
class用户
服务器日志

Devise::Mailer#confirmation_instructions: processed outbound mail in 5.5ms

Sent mail to test@gmail.com (60006.9ms)
Date: Mon, 12 Jan 2015 11:51:41 +0800
From: please-change-me-at-config-initializers-devise@example.com
Reply-To: please-change-me-at-config-initializers-devise@example.com
To: test@gmail.com
Message-ID: <54b344cd46482_5273fcf9d4fa0a410014d@Jamesons-MBP.mail>
Subject: Confirmation instructions
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

<div class="container">
  <div class="row">
    <div class="col-md-4 col-md-offset-1 devise-form">
<p>Welcome test@gmail.com!</p>

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

<p><a href="http://localhost:3000/users/confirmation?confirmation_token=2PpW7PADs1Sc2dGTkHKa">Confirm my account</a></p>
    </div>
  </div>
</div>
   (9.3ms)  commit transaction
Redirected to http://localhost:3000/
Completed 302 Found in 60110ms (ActiveRecord: 9.9ms)
designe::Mailer#确认#说明:5.5ms内处理出站邮件
发送邮件至test@gmail.com(60006.9ms)
日期:2015年1月12日星期一11:51:41+0800
发件人:请在配置初始值设定项处更改我-devise@example.com
回复:请在配置初始值设定项处更改我-devise@example.com
致:test@gmail.com
消息ID:
主题:确认说明
Mime版本:1.0
内容类型:text/html;
字符集=UTF-8
内容传输编码:7bit
欢迎光临test@gmail.com!

您可以通过以下链接确认您的帐户电子邮件:

(9.3ms)提交事务 重定向到http://localhost:3000/ 在60110ms内完成302次(ActiveRecord:9.9ms)
据我所知,电子邮件正在发送,如果我从服务器日志手动复制确认链接,我可以确认帐户,但我希望在mailcatcher界面中查看邮件

你知道我可能做错了什么吗?再次感谢


这里有一个类似的问题-,但解决方案是从config/environments.rb中删除数据,这不适用于我的情况,因为我没有向该文件添加任何数据。

这可能与此相关:config.action\u mailer.raise\u delivery\u errors=true如果您的电子邮件未实际发送,则会引发错误。虽然不能解决问题,但在开发中捕获错误非常有用。请尝试使用--verbose启动mailcatcher,以了解更多详细信息