app/services/reports/failed_emails_report.rb
def send_email_report
        # Unset the env variable to stop the emails (for example
        # on staging we don't want these emails, only on production)
        return unless ENV.key?('SEND_FAILED_EMAILS_REPORT')

        recipients = BackofficeUser.active.pluck(:email)
        report = failures.map(&:to_csv).join

        Rails.logger.info "Sending failed emails report to #{recipients.size} recipients..."

        recipients.each do |recipient|
          ReportsMailer.failed_emails_report(report, to_address: recipient).deliver_later
        end
      end
# This class method is used in the back-office
This class method is used in the back-office
This class method is used in the back - office
def send_email_report
        return unless ENV.key?('SEND_FAILED_EMAILS_REPORT')
        recipients = BackofficeUser.active.pluck(:email)
        report = failures.map(&:to_csv).join
        Rails.logger.info "Sending failed emails report to #{recipients.size} recipients..."
        recipients.each do |recipient|
          ReportsMailer.failed_emails_report(report, to_address: recipient).deliver_later
        end
      end
def send_email_report return unless ENV . key? ( 'SEND_FAILED_EMAILS_REPORT' ) recipients = BackofficeUser . active . pluck ( :email ) report = failures . map ( & :to_csv ) . join Rails . logger . info "Sending failed emails report to #{recipients.size} recipients..." recipients . each do | recipient | ReportsMailer . failed_emails_report ( report , to_address : recipient ) . deliver_later end end
This class method is used in the back-office
This class method is used in the back - office
# Unset the env variable to stop the emails (for example # on staging we don't want these emails, only on production)