Sha256: a2e3b0a7bac297eb3d37da783cc22de12978cc90a9354ab9628cc72766955e23
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
module MList class Email < ActiveRecord::Base set_table_name 'mlist_emails' include MList::Util::EmailHelpers include MList::Util::TMailReaders def been_here?(list) tmail.header_string('x-beenthere') == list.address end def from tmail.header_string('from') end # Answers the usable destination addresses of the email. # def list_addresses bounce? ? tmail.header_string('to').match(/\Amlist-(.*)\Z/)[1] : tmail.to.collect(&:downcase) end # Answers true if this email is a bounce. # # TODO Delegate to the email_server's bounce detector. # def bounce? tmail.header_string('to') =~ /mlist-/ end def tmail=(tmail) @tmail = tmail write_attribute(:source, tmail.port.read_all) end def tmail @tmail ||= TMail::Mail.parse(source) end # Provide reader delegation to *most* of the underlying TMail::Mail # methods, excluding those overridden by this Class and the [] method (an # ActiveRecord method). def method_missing(symbol, *args, &block) # :nodoc: if symbol.to_s !~ /=\Z/ && symbol != :[] && symbol != :source && tmail.respond_to?(symbol) tmail.__send__(symbol, *args, &block) else super end end def respond_to?(method) super || (method.to_s !~ /=\Z/ && tmail.respond_to?(method)) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
aiwilliams-mlist-0.1.5 | lib/mlist/email.rb |
aiwilliams-mlist-0.1.6 | lib/mlist/email.rb |