Sha256: abbb3ad00d06bd028bd6b48952d3cbc1267de72ffa72021f9dc36a70e1e06d92

Contents?: true

Size: 738 Bytes

Versions: 20

Compression:

Stored size: 738 Bytes

Contents

require 'pop_ssl'

module MList
  module EmailServer
    
    class Pop < Base
      def deliver(tmail)
        raise "Mail cannot be delivered through a POP server. Please use the '#{MList::EmailServer::Default.name}' type."
      end
      
      def execute
        connect_to_email_account do |pop|
          pop.mails.each { |message| receive(TMail::Mail.parse(message.pop)); message.delete }
        end
      end
      
      private
        def connect_to_email_account
          pop3 = Net::POP3.new(settings[:server], settings[:port], false)
          pop3.enable_ssl if settings[:ssl]
          pop3.start(settings[:username], settings[:password]) do |pop|
            yield pop
          end
        end
    end
    
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
aiwilliams-mlist-0.1.3 lib/mlist/email_server/pop.rb
aiwilliams-mlist-0.1.4 lib/mlist/email_server/pop.rb
aiwilliams-mlist-0.1.5 lib/mlist/email_server/pop.rb
aiwilliams-mlist-0.1.6 lib/mlist/email_server/pop.rb
aiwilliams-mlist-0.1.7 lib/mlist/email_server/pop.rb
aiwilliams-mlist-0.1.8 lib/mlist/email_server/pop.rb
mlist-0.1.23 lib/mlist/email_server/pop.rb
mlist-0.1.22 lib/mlist/email_server/pop.rb
mlist-0.1.21 lib/mlist/email_server/pop.rb
mlist-0.1.20 lib/mlist/email_server/pop.rb
mlist-0.1.19 lib/mlist/email_server/pop.rb
mlist-0.1.18 lib/mlist/email_server/pop.rb
mlist-0.1.17 lib/mlist/email_server/pop.rb
mlist-0.1.16 lib/mlist/email_server/pop.rb
mlist-0.1.14 lib/mlist/email_server/pop.rb
mlist-0.1.13 lib/mlist/email_server/pop.rb
mlist-0.1.12 lib/mlist/email_server/pop.rb
mlist-0.1.11 lib/mlist/email_server/pop.rb
mlist-0.1.10 lib/mlist/email_server/pop.rb
mlist-0.1.9 lib/mlist/email_server/pop.rb