设计注册确认邮件已发送,但用户看不到这些消息
Devise registration confirmation says that mail was sent but users don't see these messages
我在 Rails 申请 Ruby 时获得了设计授权。我添加新用户注册确认,如 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, ...]
我做错了什么?在哪里可以找到发送失败的原因?
打开 /config/environment/development.rb
并改变
config.action_mailer.raise_delivery_errors = false
至
config.action_mailer.raise_delivery_errors = true
获取电子邮件错误。
我在 Rails 申请 Ruby 时获得了设计授权。我添加新用户注册确认,如 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, ...]
我做错了什么?在哪里可以找到发送失败的原因?
打开 /config/environment/development.rb
并改变
config.action_mailer.raise_delivery_errors = false
至
config.action_mailer.raise_delivery_errors = true
获取电子邮件错误。