P
P
Pavel Grudinkin2016-08-09 01:07:31
Ruby on Rails
Pavel Grudinkin, 2016-08-09 01:07:31

How to configure devise so that you can send “regular” emails?

There is a configured devise, letters with account confirmation, password recovery are sent. There is a "regular" email that was normally sent before the devise was installed:

class ServiceMailer < ApplicationMailer
  default :from => '[email protected]'

  def notify_record(service_mail, record)
    @record = record
    mail(to: service_mail, subject: 'Новая запись')
  end
end

class RecordsController < InheritedResources::Base
  respond_to :json
  protect_from_forgery :except => :create

  def create
    # pp params
    r = Record.create(:name => params[:fio], :phone => params[:phone], :date => params[:date], :job_id => params[:job], :address_id => params[:address])


    ServiceMailer.notify_record(
      Service.joins(:addresses).where(:addresses => {:id => params[:address]}).first.email,
      r
      ).deliver_now

    render :json => {}, :status => 200
  end
end

But now I'm getting an error:
Net::SMTPFatalError (553 5.7.1 Sender address rejected: not owned by auth user

What else needs to be configured to make it work?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question