设计注册确认说邮件已发送但用户没有看到这些邮件

时间:2015-10-27 09:06:34

标签: ruby-on-rails devise devise-confirmable

我有Ruby on Rails应用程序并具有设计授权。我在manual中添加了新用户注册的确认信息。

但是新用户不会收到确认消息。

确认发送日志表示电子邮件已成功发送:

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

Sent mail to new-user@email.com (60066.4ms)
Date: Tue, 27 Oct 2015 13:24:12 +0500
From: from@our-mail.com
Reply-To: reply-to@our-mail.com
To: from@our-mail.com
Message-ID: <message-id@my-machine.mail>
Subject: Confirmation instructions
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

<p>Hello new-user@email.com!</p>    
<p>You can confirm your account email through the link below.:</p>    
<p><a href="http://www.example.com:3100/users/confirmation?confirmation_token=token">Confirm my account</a></p>

但是当我转到新用户的电子邮件时,即使在垃圾邮件文件夹中,我也看不到确认信。我试过几个不同的电子邮件提供商 - 到处都有相同的结果。

我直接从我的应用程序代码(没有设计)发送的另一封信件成功发送和接收。

我在/config/environment/development.rb发送设置的电子邮件:

config.action_mailer.default_url_options = {:host => 'www.example.com:3100'}
config.action_mailer.delivery_method = :smtp

config.action_mailer.smtp_settings = {
    :address => ENV['SMTP_ADDRESS'],
    :port => ENV['SMTP_PORT'],
    :user_name => ENV['SMTP_USERNAME'],
    :password => ENV['SMTP_PASSWORD'],
    :authentication => 'login',
    :enable_starttls_auto => true
}

user模型:

class User < ActiveRecord::Base
    devise :database_authenticatable,
           :registerable,
           :confirmable,
           # :async, # I will enable async when confirmation will work at least in sync mode
           :recoverable,
           :rememberable,
           :trackable,
           :validatable,
           :omniauthable,
           :omniauth_providers => [:provider1, :provider2, ...]

我做错了什么?我在哪里可以找到发送失败的原因?

1 个答案:

答案 0 :(得分:2)

打开/config/environment/development.rb

并更改

config.action_mailer.raise_delivery_errors = false 

config.action_mailer.raise_delivery_errors = true 

获取电子邮件的错误。