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 @url = "http://store.tp.rulingcom.com/cpanel/reset_password?id=#{@user_id}&token=#{@reset_token}" mail(:to => email, :subject => "Reset Password Instructions") end def send_user_confirmation(user) setup @confirmation_token = user.confirmation_token @user_id = user.id @url = "http://store.tp.rulingcom.com/cpanel/confirm_email?id=#{@user_id}&token=#{@confirmation_token}" mail(:to => user.email, :subject => "Orbit - Confirm Email") end end