orbit-4-2/app/mailer/user_mailer.rb

35 lines
1.0 KiB
Ruby

class UserMailer < Devise::Mailer
# default :from => "noreply@rulingcom.com"
@site = Site.first
@smtp_settings = {
:address => @site['site_settings']['address'],
:port => @site['site_settings']['port'],
:domain => @site['site_settings']['domain'],
:authentication => @site['site_settings']['authentication'],
:enable_starttls_auto => @site['site_settings']['enable_starttls_auto']
}
if !@site['site_settings']['user_name'].blank?
@smtp_settings[:user_name] = @site['site_settings']['user_name']
end
if !@site['site_settings']['password'].blank?
@smtp_settings[:password] = @site['site_settings']['password']
end
if !@site['site_settings']['service_email'].blank?
@smtp_settings[:from] = @site['site_settings']['service_email']
Devise.mailer_sender = @site['site_settings']['service_email']
end
if !@site['site_settings']['reply_email'].blank?
@smtp_settings[:reply_to] = @site['site_settings']['reply_email']
end
ActionMailer::Base.smtp_settings = @smtp_settings
end