Sha256: e2dc256a0938967765a1c7fe45ad3041142d2f86fd1a4d7bf1b84bdd4fb65c8b
Contents?: true
Size: 1.54 KB
Versions: 2
Compression:
Stored size: 1.54 KB
Contents
def require_local(file) require File.join(File.dirname(__FILE__), 'chimpster', file) end require_local 'message_extensions/shared' require_local 'message_extensions/mail' require_local 'handlers/mail' require 'logging' module Chimpster MAX_RETRIES = 2 class << self attr_accessor :api_key, :to, :from, :max_retries, :sleep_between_retries , :uakari, :logger def logger Logging.logger(STDOUT) end def max_retries @max_retries ||= 3 end def sleep_between_retries @sleep_between_retries ||= 10 end def configure yield self end def send (message) response = @uakari.send_email(message) response end def send_through_chimpster(message) #:nodoc: puts 'sending email' @retries = 0 _from = message['from'].to_s _from = @from unless @from == nil _to =message['to'].to_s _to = @to unless @to == nil options= { :html => "test" ,#message.body.raw_source, :subject => message.subject, :from_email => _from, :to_email => _to.split(',') } response = self.send({ :track_opens => true, :track_clicks => true, :message => options, :tags => (message.tag.to_s if message.tag) }) c=response['status'] v= ['queued','sent'].include?(c) if v == false logger.info "ERROR Sending Email via Chimpster #{response.to_s}" else logger.info "Email Sent via Chimpster #{response.to_s}" end v end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
chimpster-0.1.18 | lib/chimpster.rb |
chimpster-0.1.17 | lib/chimpster.rb |