Module: Ronin::Network::Mixins::POP3

Includes:
Mixin, POP3
Defined in:
lib/ronin/network/mixins/pop3.rb

Overview

Adds POP3 convenience methods and connection parameters to a class.

Defines the following parameters:

  • host (String) - POP3 host.
  • port (Integer) - POP3 port.
  • pop3_user (String) - POP3 user to login as.
  • pop3_password (String) - POP3 password to login with.

Constant Summary

Constants included from POP3

POP3::DEFAULT_PORT

Instance Method Summary collapse

Methods included from Mixin

included

Methods included from POP3

default_port, default_port=

Instance Method Details

#pop3_connect(options = {}) {|session| ... } ⇒ Net::POP3 (protected)

Creates a connection to the POP3 server. The host},port, pop3_userandpop3_password` parameters will also be used to connect to the server.

Parameters:

  • options (Hash) (defaults to: {})

    Additional options.

Options Hash (options):

  • :port (Integer) — default: Ronin::Network::POP3.default_port

    The port the POP3 server is running on.

  • :user (String)

    The user to authenticate with when connecting to the POP3 server.

  • :password (String)

    The password to authenticate with when connecting to the POP3 server.

Yields:

  • (session)

    If a block is given, it will be passed the newly created POP3 session.

Yield Parameters:

  • session (Net::POP3)

    The newly created POP3 session.

Returns:

  • (Net::POP3)

    The newly created POP3 session.

See Also:


90
91
92
93
94
# File 'lib/ronin/network/mixins/pop3.rb', line 90

def pop3_connect(options={},&block)
  print_info "Connecting to #{host_port} ..."

  return super(self.host,pop3_merge_options(options),&block)
end

#pop3_session(options = {}) {|session| ... } ⇒ Object (protected)

Starts a session with the POP3 server. The host, port, pop3_user and pop3_password parameters will also be used to connect to the server.

Yields:

  • (session)

    If a block is given, it will be passed the newly created POP3 session. After the block has returned, the session will be closed.

Yield Parameters:

  • session (Net::POP3)

    The newly created POP3 session.

See Also:


113
114
115
116
117
118
119
120
121
# File 'lib/ronin/network/mixins/pop3.rb', line 113

def pop3_session(options={})
  super(options) do |sess|
    yield sess if block_given?

    print_info "Logging out ..."
  end

  print_info "Disconnected to #{host_port}"
end