mail config

This commit is contained in:
Harry Bomrah 2017-04-12 19:15:59 +08:00
parent bbbdd1f89b
commit c552b6ecbe
1 changed files with 18 additions and 0 deletions

View File

@ -1,7 +1,24 @@
class ResetCPanelPasswordMailer < ActionMailer::Base class ResetCPanelPasswordMailer < ActionMailer::Base
default from: "noreply@rulingcom.com" default from: "noreply@rulingcom.com"
def setup
site = Site.first
mail_setting = {
: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'],
:user_name => site['site_settings']['user_name'].blank? ? nil : site['site_settings']['user_name'],
:password => site['site_settings']['password'].blank? ? nil : site['site_settings']['password']
}
ActionMailer::Base.smtp_settings = mail_setting
end
def reset_user_password(user) def reset_user_password(user)
setup
email = user.email email = user.email
@reset_token = user.reset_token @reset_token = user.reset_token
@user_id = user.id @user_id = user.id
@ -10,6 +27,7 @@ class ResetCPanelPasswordMailer < ActionMailer::Base
end end
def send_user_confirmation(user) def send_user_confirmation(user)
setup
@confirmation_token = user.confirmation_token @confirmation_token = user.confirmation_token
@user_id = user.id @user_id = user.id
@url = "http://storedemo.pending.rulingcom.com/cpanel/confirm_email?id=#{@user_id}&token=#{@confirmation_token}" @url = "http://storedemo.pending.rulingcom.com/cpanel/confirm_email?id=#{@user_id}&token=#{@confirmation_token}"