module Mailbot::Mailer
Constants
- BLOCK_SYMBOL
Public Class Methods
block()
click to toggle source
# File lib/mailbot/mailer.rb, line 17 def block Thread.current[BLOCK_SYMBOL] || default end
default()
click to toggle source
# File lib/mailbot/mailer.rb, line 21 def default ->(subject, body) do mailgun = Mailgun::Client.new ENV["MAILBOT_MAILGUN_API_KEY"] params = { :from => ENV["MAILBOT_MAIL_FROM"], :to => ENV["MAILBOT_MAIL_TO"], :subject => subject, :html => body } mailgun.send_message ENV["MAILBOT_MAILGUN_DOMAIN"], params end end
deliver(subject: "", body: "")
click to toggle source
# File lib/mailbot/mailer.rb, line 9 def deliver(subject: "", body: "") block.call subject, body end
set(&block)
click to toggle source
# File lib/mailbot/mailer.rb, line 13 def set(&block) Thread.current[BLOCK_SYMBOL] = block end