Module: CamaleonCms::EmailHelper

Included in:
CamaleonController
Defined in:
app/helpers/camaleon_cms/email_helper.rb

Instance Method Summary collapse

Instance Method Details

#send_email(email, subject = 'Tiene una notificacion', content = '', from = nil, attachs = [], template_name = 'mailer', layout_name = 'camaleon_cms/mailer', extra_data = {}) ⇒ Object

send and email email: email to subject: Subject of the email content: content of the email from: email figured as from attachs: array of files to be attached to the email layout_name: path of the template to render template_name: template name to render in template_path


11
12
13
14
15
16
17
# File 'app/helpers/camaleon_cms/email_helper.rb', line 11

def send_email(email, subject='Tiene una notificacion', content='', from=nil, attachs=[], template_name = 'mailer', layout_name = 'camaleon_cms/mailer', extra_data = {})
  # Thread.abort_on_exception=true
  Thread.new do
    HtmlMailer.sender(email, subject, content, from, attachs, cama_root_url, current_site, template_name, layout_name, extra_data).deliver_now
    ActiveRecord::Base.connection.close
  end
end

#send_user_confirm_email(user_to_confirm) ⇒ Object


19
20
21
22
23
24
25
# File 'app/helpers/camaleon_cms/email_helper.rb', line 19

def send_user_confirm_email(user_to_confirm)
  user_to_confirm.send_confirm_email
  confirm_email_url = cama_admin_confirm_email_url({h: @user.confirm_email_token})
  Rails.logger.info "Sending email verification to #{user_to_confirm}"
  extra_data = {:url => confirm_email_url, :fullname => user_to_confirm.fullname}
  send_email(user_to_confirm.email, t('camaleon_cms.admin.login.confirm.text'), '', nil, [], 'confirm_email', 'camaleon_cms/mailer', extra_data)
end