General Failure
General Failure

Reputation: 2597

Devise registration confirmation says that mail was sent but users don't see these messages

I have Ruby on Rails application with devise authorization. I add confirmation for new user registration as in manual.

But new users doesn't receive confirmation messages.

Confirmation sending log says that email was successfully sent:

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

Sent mail to [email protected] (60066.4ms)
Date: Tue, 27 Oct 2015 13:24:12 +0500
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>Hello [email protected]!</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>

But when I goes to new user's email, I don't see confirmation letter nowhere, even in spam folder. I tried several different email providers - everywhere result is same.

Another letters that I sends directly from my application code (without devise) sends and receives successfully.

My email sending settings in /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
}

And user model:

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, ...]

What am I doing wrong? Where can I found reason of sending failure?

Upvotes: 0

Views: 727

Answers (1)

Pardeep Saini
Pardeep Saini

Reputation: 2102

Open /config/environment/development.rb

and change

config.action_mailer.raise_delivery_errors = false 

to

config.action_mailer.raise_delivery_errors = true 

to get the error for email.

Upvotes: 2

Related Questions