Shruthi R Shruthi R - 7 months ago 108
Ruby Question

Rails 4 - yandex mail is not sending

In rails 4.2.4, I am using

gem 'rails_config'
for emails feature. In development environment all mails are sending properly but in test environment it is showing an error like
Net::SMTPFatalError (553 5.7.1 Sender address rejected: not owned by auth user.):


In setup_mail.rb

ActionMailer::Base.smtp_settings = {
:address => "smtp.yandex.ru",
:port => 465,
:domain => "yandex.ru",
:authentication => :login,
:user_name => "ssstest@yandex.com",
:password => "pwd567@",
:ssl=> true,
:enable_starttls_auto=> true,
:tls=> true
}


In user_mailer.rb

class UserMailer < ActionMailer::Base
default from: "ssstest@yandex.com"
...
end


Server log's output is,

D, [2016-05-06T06:24:25.089270 #23566] DEBUG -- :
Devise::Mailer#confirmation_instructions: processed outbound mail in 954.3ms
I, [2016-05-06T06:24:26.500832 #23566] INFO -- :
Sent mail to sample_demo@yopmail.com (1408.8ms)
D, [2016-05-06T06:24:26.501240 #23566] DEBUG -- : Date: Fri, 06 May 2016 06:24:25 +0000
From: please-change-me-at-config-initializers-devise@example.com
Reply-To: please-change-me-at-config-initializers-devise@example.com
To: sample_demo@yopmail.com
Message-ID: <572c389917f09_5c0e10bb99411990@ip-10-65-178-51.mail>
Subject: Confirmation instructions
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit


How can I fix this issue? Please help me

Answer

As the error log indicates, please change the from email address inside config/initializers/devise.rb

config.mailer_sender = 'ssstest@yandex.com'