<commit_before>=begin
  Camaleon CMS is a content management system
  Copyright (C) 2015 by <NAME>
  Email: <EMAIL>
  This program is free software: you can redistribute it and/or modify   it under the terms of the GNU Affero General Public License as  published by the Free Software Foundation, either version 3 of the  License, or (at your option) any later version.
  This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the  GNU Affero General Public License (GPLv3) for more details.
=end
class CamaleonCms::HtmlMailer < ActionMailer::Base
  include CamaleonCms::SiteHelper
  include CamaleonCms::HooksHelper
  include CamaleonCms::PluginsHelper
  #include ApplicationHelper
  default from: "Camaleon CMS <<EMAIL>>"
  after_action :set_delivery_options

  # content='', from=nil, attachs=[], url_base='', current_site, template_name, layout_name, extra_data, format, cc_to
  def sender(email, subject='Hello', data = {})
    data = {}.merge(data)
    @subject = subject
    @html = data[:content]
    @url_base = data[:url_base]
    @current_site = data[:current_site]
    @extra_data = data[:extra_data]

    mail_data = {to: email, subject: subject}
    mail_data[:from] = data[:from] if data[:from].present?
    mail_data[:cc] = data[:cc_to].join(",") if data[:cc_to].present?
    if current_site.get_option("mailer_enabled") == 1
      mail_data[:delivery_method] = :smtp
      mail_data[:delivery_method_options] = {user_name: current_site.get_option("email_username"),
                                             password: <PASSWORD>("email_pass"),
                                             address: current_site.get_option("email_server"),
                                             port: current_site.get_option("email_port"),
                                             domain: (current_site.the_url.to_s.parse_domain rescue "localhost"),
                                             authentication: "plain",
                                             enable_starttls_auto: true
      }
    end
<commit_msg>added email from setting<commit_after>=begin
  Camaleon CMS is a content management system
  Copyright (C) 2015 by <NAME>
  Email: <EMAIL>
  This program is free software: you can redistribute it and/or modify   it under the terms of the GNU Affero General Public License as  published by the Free Software Foundation, either version 3 of the  License, or (at your option) any later version.
  This program is distributed in the hope that it will be useful,  but WITHOUT ANY WARRANTY; without even the implied warranty of  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the  GNU Affero General Public License (GPLv3) for more details.
=end
class CamaleonCms::HtmlMailer < ActionMailer::Base
  include CamaleonCms::SiteHelper
  include CamaleonCms::HooksHelper
  include CamaleonCms::PluginsHelper
  #include ApplicationHelper
  default from: "Camaleon CMS <<EMAIL>>"
  after_action :set_delivery_options

  # content='', from=nil, attachs=[], url_base='', current_site, template_name, layout_name, extra_data, format, cc_to
  def sender(email, subject='Hello', data = {})
    data = {cc_to: [], from: current_site.get_option("email")}.merge(data)
    @subject = subject
    @html = data[:content]
    @url_base = data[:url_base]
    @current_site = data[:current_site]
    @extra_data = data[:extra_data]

    mail_data = {to: email, subject: subject}
    if current_site.get_option("mailer_enabled") == 1
      mail_data[:delivery_method] = :smtp
      mail_data[:delivery_method_options] = {user_name: current_site.get_option("email_username"),
                                             password: <PASSWORD>("email_pass"),
                                             address: current_site.get_option("email_server"),
                                             port: current_site.get_option("email_port"),
                                             domain: (current_site.the_url.to_s.parse_domain rescue "localhost"),
                                             authentication: "plain",
                                             enable_starttls_auto: true
      }
      data[:cc] << current_site.get_option("email_cc")
      data[:from] = current_site.get_option("email_from", data[:from])
    end
    mail_data[:cc] = data[:cc_to].join(",") if data[:cc_to].present?
    mail_data[:from] = data[:from] if data[:from].present?

{'fraction_non_alphanumeric': 0.09588131089459699, 'fraction_numerical': 0.003100088573959256, 'mean_word_length': 2.805391743892165, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4924622', 'n_tokens_mistral': 1223, 'n_tokens_neox': 1208, 'n_words': 366}