Class: Mailman::Receiver::POP3
- Inherits:
-
Object
- Object
- Mailman::Receiver::POP3
- Defined in:
- lib/mailman/receiver/pop3.rb
Overview
Receives messages using POP3, and passes them to a MessageProcessor.
Instance Attribute Summary (collapse)
-
- (Net::POP3) connection
readonly
The POP3 connection.
Instance Method Summary (collapse)
-
- (Object) connect
Connects to the POP3 server.
-
- (Object) disconnect
Disconnects from the POP3 server.
-
- (Object) get_messages
Iterates through new messages, passing them to the processor, and deleting them.
-
- (POP3) initialize(options)
constructor
A new instance of POP3.
Constructor Details
- (POP3) initialize(options)
A new instance of POP3
19 20 21 22 23 24 25 |
# File 'lib/mailman/receiver/pop3.rb', line 19 def initialize() @processor = [:processor] @username = [:username] @password = [:password] @connection = Net::POP3.new([:server], [:port]) @connection.enable_ssl(OpenSSL::SSL::VERIFY_NONE) if [:ssl] end |
Instance Attribute Details
- (Net::POP3) connection (readonly)
The POP3 connection
9 10 11 |
# File 'lib/mailman/receiver/pop3.rb', line 9 def connection @connection end |
Instance Method Details
- (Object) connect
Connects to the POP3 server.
28 29 30 |
# File 'lib/mailman/receiver/pop3.rb', line 28 def connect @connection.start(@username, @password) end |
- (Object) disconnect
Disconnects from the POP3 server.
33 34 35 |
# File 'lib/mailman/receiver/pop3.rb', line 33 def disconnect @connection.finish end |
- (Object) get_messages
Iterates through new messages, passing them to the processor, and deleting them.
39 40 41 42 43 44 |
# File 'lib/mailman/receiver/pop3.rb', line 39 def @connection.each_mail do || @processor.process(.pop) end @connection.delete_all end |