Method: ActivityNotification::NotificationApi#send_notification_email

Defined in:
lib/activity_notification/apis/notification_api.rb

#send_notification_email(options = {}) ⇒ Mail::Message, ActionMailer::DeliveryJob

Sends notification email to the target.

Parameters:

  • options (Hash) (defaults to: {})

    Options for notification email

Options Hash (options):

  • :send_later (Boolean)

    If it sends notification email asynchronously

  • :fallback (String, Symbol) — default: :default

    Fallback template to use when MissingTemplate is raised

Returns:

  • (Mail::Message, ActionMailer::DeliveryJob)

    Email message or its delivery job



521
522
523
524
525
526
527
528
529
530
# File 'lib/activity_notification/apis/notification_api.rb', line 521

def send_notification_email(options = {})
  if target.notification_email_allowed?(notifiable, key) &&
     notifiable.notification_email_allowed?(target, key) &&
     email_subscribed?
    send_later = options.has_key?(:send_later) ? options[:send_later] : true
    send_later ?
      @@notification_mailer.send_notification_email(self, options).deliver_later :
      @@notification_mailer.send_notification_email(self, options).deliver_now
  end
end