module Octo::Email
Public Instance Methods
enqueue_msg(message)
click to toggle source
send(email, subject, opts = {})
click to toggle source
Send Emails using mandrill api @param [Text] email Email
Address of the receiver @param [Text] subject Subject of Email
@param [Hash] opt Hash
contain other message details
# File lib/octocore-cassandra/email.rb, line 14 def send(email, subject, opts = {}) if email.nil? or subject.nil? raise ArgumentError, 'Email Address or Subject is missing' else message = { from_name: Octo.get_config(:email_sender).fetch(:name), from_email: Octo.get_config(:email_sender).fetch(:email), subject: subject, text: opts.fetch('text', nil), html: opts.fetch('html', nil), to: [{ email: email, name: opts.fetch('name', nil) }] } # Pass the message to resque only when mandrill key is present _mandrill_config = ENV['MANDRILL_API_KEY'] || Octo.get_config(:mandrill_api_key) if _mandrill_config and !_mandrill_config.empty? enqueue_msg(message) end end end