Module: CamaleonCms::EmailHelper
- Includes:
- HooksHelper
- Included in:
- CamaleonController
- Defined in:
- app/helpers/camaleon_cms/email_helper.rb
Instance Method Summary collapse
-
#cama_send_email(email_to, subject, args = {}) ⇒ Object
short method of send_email args: content=”, from=nil, attachs=[], url_base=”, current_site, template_name, layout_name, extra_data, format, cc_to.
-
#cama_send_mail_to_admin(subject, args = {}) ⇒ Object
send email to the first administrator args: same arguments than cama_send_email.
-
#send_email(email, subject = 'Notification', content = '', from = nil, attachs = [], template_name = nil, layout_name = nil, 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.
- #send_password_reset_email(user_to_send) ⇒ Object
- #send_user_confirm_email(user_to_confirm) ⇒ Object
Methods included from HooksHelper
#hook_run, #hook_skip, #hooks_run
Methods included from PluginsHelper
#current_plugin, #plugin_asset_path, #plugin_asset_url, #plugin_destroy, #plugin_install, #plugin_layout, #plugin_load_helpers, #plugin_uninstall, #plugin_upgrade, #plugin_view, #plugins_initialize, #self_plugin_key
Methods included from SiteHelper
#cama_current_site_host_port, #cama_get_list_layouts_files, #cama_get_list_template_files, #cama_is_test_request?, #current_locale, #current_site, #current_theme, #site_after_install, #site_install_theme, #site_uninstall_theme
Instance Method Details
#cama_send_email(email_to, subject, args = {}) ⇒ Object
short method of send_email args: content=”, from=nil, attachs=[], url_base=”, current_site, template_name, layout_name, extra_data, format, cc_to
24 25 26 27 28 29 30 31 32 |
# File 'app/helpers/camaleon_cms/email_helper.rb', line 24 def cama_send_email(email_to, subject, args = {}) args = { url_base: cama_root_url, current_site: current_site, subject: subject }.merge(args) args[:attachments] = args[:attachs] if args[:attachs].present? args[:current_site] = args[:current_site].id # run hook "email" to customize values hooks_run('email', args) CamaleonCms::HtmlMailer.sender(email_to, args[:subject], args).deliver_later end |
#cama_send_mail_to_admin(subject, args = {}) ⇒ Object
send email to the first administrator args: same arguments than cama_send_email
57 58 59 60 |
# File 'app/helpers/camaleon_cms/email_helper.rb', line 57 def cama_send_mail_to_admin(subject, args = {}) cama_send_email(current_site.get_option('system_email', current_site.users.admin_scope.first.email), subject, args) end |
#send_email(email, subject = 'Notification', content = '', from = nil, attachs = [], template_name = nil, layout_name = nil, 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
12 13 14 15 16 17 18 19 20 |
# File 'app/helpers/camaleon_cms/email_helper.rb', line 12 def send_email(email, subject = 'Notification', content = '', from = nil, attachs = [], template_name = nil, layout_name = nil, extra_data = {}) args = { attachs: attachs, extra_data: extra_data } args[:template_name] = template_name if template_name.present? args[:layout_name] = layout_name if layout_name.present? args[:from] = from if from.present? args[:content] = content if content.present? cama_send_email(email, subject, args) end |
#send_password_reset_email(user_to_send) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/helpers/camaleon_cms/email_helper.rb', line 43 def send_password_reset_email(user_to_send) user_to_send.send_password_reset reset_url = cama_admin_forgot_url({ h: user_to_send.password_reset_token }) extra_data = { url: reset_url, fullname: user_to_send.fullname, user: user_to_send } send_email(user_to_send.email, t('camaleon_cms.admin.login.message.subject_email'), '', nil, [], 'password_reset', 'camaleon_cms/mailer', extra_data) end |
#send_user_confirm_email(user_to_confirm) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'app/helpers/camaleon_cms/email_helper.rb', line 34 def send_user_confirm_email(user_to_confirm) user_to_confirm.send_confirm_email confirm_email_url = cama_admin_confirm_email_url({ h: user_to_confirm.confirm_email_token }) Rails.logger.debug "Camaleon CMS - 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 |