Skip to content

Not working with custom notifiers #9

Description

@Aetherus

Hi, nikhaldi

I wrote a custom email notifier:

module ExceptionNotifier
  class DynamicEmailNotifier < EmailNotifier
    def call(exception, options={})
      options.reverse_merge!(exception_recipients: Admin.where(notified: true).pluck(:email))
      super
    end
  end
end

and added the following configuration to config/environments/<env>:

Rails.application.configure do
  # ...
  config.middleware.use ExceptionNotification::Rack,
    dynamic_email: {
        email_prefix: '[EDM2] ',
        sender_address: 'Admin <admin@zzz.zz>',
        # Override default action mailer settings.
        delivery_method: :smtp,
        smtp_settings: {
            address: '127.0.0.1',
            port: 25,
            user_name: 'admin@zzz.zz',
            password: Rails.application.secrets[:sender_password],
            authentication: :plain,
            enable_starttls_auto: true,
            openssl_verify_mode: 'none'
        }
    }
  ExceptionNotifier::Rake.configure
end

It works well when the exceptions are triggered by the HTTP requests, but when the exceptions are from rake tasks, no email is sent, and there is no record in maillog indicating that any email delivery has been tried.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions