Class: Notify::Adapters::Email
- Defined in:
- lib/notify/adapters/email.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.template_extensions ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/notify/adapters/email.rb', line 36 def self.template_extensions formats = begin ActionView::Template::Types.symbols rescue StandardError %i[html text] end handlers = ActionView::Template::Handlers.extensions extensions = [] formats.each do |format| handlers.each do |handler| extensions << :"#{format}.#{handler}" end end handlers.each { |h| extensions << h } extensions.uniq end |
Instance Method Details
#deliver(message_name:, to:, subject:, locals:, template_path:, options: {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/notify/adapters/email.rb', line 8 def deliver(message_name:, to:, subject:, locals:, template_path:, options: {}) subject = apply_subject_prefix(subject) from = [:from] cc = [:cc] bcc = [:bcc] delivery_method = [:delivery_method] || email_config[:delivery_method] || :deliver_later configure_mailer! = Notify::Mailer.dispatch( , locals: locals, to: Array(to), subject: subject, from: from, cc: cc, bcc: bcc, template_path: template_path.to_s ) case delivery_method.to_sym when :deliver_now .deliver_now else .deliver_later end end |