diff --git a/app/mailers/reset_c_panel_password_mailer.rb b/app/mailers/reset_c_panel_password_mailer.rb index 18b0824..46cb360 100644 --- a/app/mailers/reset_c_panel_password_mailer.rb +++ b/app/mailers/reset_c_panel_password_mailer.rb @@ -1,7 +1,24 @@ class ResetCPanelPasswordMailer < ActionMailer::Base 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) + setup email = user.email @reset_token = user.reset_token @user_id = user.id @@ -10,6 +27,7 @@ class ResetCPanelPasswordMailer < ActionMailer::Base end def send_user_confirmation(user) + setup @confirmation_token = user.confirmation_token @user_id = user.id @url = "http://storedemo.pending.rulingcom.com/cpanel/confirm_email?id=#{@user_id}&token=#{@confirmation_token}"