Module: Ronin::Network::Mixins::SMTP
Overview
Adds SMTP convenience methods and connection parameters to a class.
Defines the following parameters:
host
(String
) - SMTP host.port
(Integer
) - SMTP port.smtp_login
(String
) - SMTP authentication method.smtp_user
(String
) - SMTP user to login as.smtp_password
(String
) - SMTP password to login with.
Constant Summary
Constants included from SMTP
Class Method Summary collapse
-
.host ⇒ Object
SMTP host.
-
.host=(value) ⇒ Object
SMTP host.
-
.port ⇒ Object
SMTP port.
-
.port=(value) ⇒ Object
SMTP port.
-
.smtp_login ⇒ Object
SMTP authentication method.
-
.smtp_login=(value) ⇒ Object
SMTP authentication method.
-
.smtp_password ⇒ Object
SMTP user to login with.
-
.smtp_password=(value) ⇒ Object
SMTP user to login with.
-
.smtp_user ⇒ Object
SMTP user to login as.
-
.smtp_user=(value) ⇒ Object
SMTP user to login as.
Instance Method Summary collapse
-
#host ⇒ Object
SMTP host.
-
#host=(value) ⇒ Object
SMTP host.
-
#port ⇒ Object
SMTP port.
-
#port=(value) ⇒ Object
SMTP port.
-
#smtp_connect(options = {}) {|session| ... } ⇒ Net::SMTP
protected
Creates a connection to the SMTP server.
-
#smtp_login ⇒ Object
SMTP authentication method.
-
#smtp_login=(value) ⇒ Object
SMTP authentication method.
-
#smtp_password ⇒ Object
SMTP user to login with.
-
#smtp_password=(value) ⇒ Object
SMTP user to login with.
-
#smtp_session(options = {}) {|session| ... } ⇒ Object
protected
Starts a session with the SMTP server.
-
#smtp_user ⇒ Object
SMTP user to login as.
-
#smtp_user=(value) ⇒ Object
SMTP user to login as.
Methods included from Mixin
Methods included from SMTP
default_port, default_port=, message, #smtp_message, #smtp_send_message
Class Method Details
.host ⇒ Object
SMTP host
41 42 |
# File 'lib/ronin/network/mixins/smtp.rb', line 41 parameter :host, :type => String, :description => 'SMTP host' |
.host=(value) ⇒ Object
SMTP host
41 42 |
# File 'lib/ronin/network/mixins/smtp.rb', line 41 parameter :host, :type => String, :description => 'SMTP host' |
.port ⇒ Object
SMTP port
45 46 |
# File 'lib/ronin/network/mixins/smtp.rb', line 45 parameter :port, :type => Integer, :description => 'SMTP port' |
.port=(value) ⇒ Object
SMTP port
45 46 |
# File 'lib/ronin/network/mixins/smtp.rb', line 45 parameter :port, :type => Integer, :description => 'SMTP port' |
.smtp_login ⇒ Object
SMTP authentication method
49 50 |
# File 'lib/ronin/network/mixins/smtp.rb', line 49 parameter :smtp_login, :type => String, :description => 'SMTP authentication method' |
.smtp_login=(value) ⇒ Object
SMTP authentication method
49 50 |
# File 'lib/ronin/network/mixins/smtp.rb', line 49 parameter :smtp_login, :type => String, :description => 'SMTP authentication method' |
.smtp_password ⇒ Object
SMTP user to login with
57 58 |
# File 'lib/ronin/network/mixins/smtp.rb', line 57 parameter :smtp_password, :type => String, :description => 'SMTP password to login with' |
.smtp_password=(value) ⇒ Object
SMTP user to login with
57 58 |
# File 'lib/ronin/network/mixins/smtp.rb', line 57 parameter :smtp_password, :type => String, :description => 'SMTP password to login with' |
Instance Method Details
#host ⇒ Object
SMTP host
41 42 |
# File 'lib/ronin/network/mixins/smtp.rb', line 41 parameter :host, :type => String, :description => 'SMTP host' |
#host=(value) ⇒ Object
SMTP host
41 42 |
# File 'lib/ronin/network/mixins/smtp.rb', line 41 parameter :host, :type => String, :description => 'SMTP host' |
#port ⇒ Object
SMTP port
45 46 |
# File 'lib/ronin/network/mixins/smtp.rb', line 45 parameter :port, :type => Integer, :description => 'SMTP port' |
#port=(value) ⇒ Object
SMTP port
45 46 |
# File 'lib/ronin/network/mixins/smtp.rb', line 45 parameter :port, :type => Integer, :description => 'SMTP port' |
#smtp_connect(options = {}) {|session| ... } ⇒ Net::SMTP (protected)
Creates a connection to the SMTP server. The host
, port
,
smtp_login
, smtp_user
and smtp_password
parameters
will also be used to connect to the server.
99 100 101 102 103 |
# File 'lib/ronin/network/mixins/smtp.rb', line 99 def smtp_connect(={},&block) print_info "Connecting to #{host_port} ..." return super(self.host,(),&block) end |
#smtp_login ⇒ Object
SMTP authentication method
49 50 |
# File 'lib/ronin/network/mixins/smtp.rb', line 49 parameter :smtp_login, :type => String, :description => 'SMTP authentication method' |
#smtp_login=(value) ⇒ Object
SMTP authentication method
49 50 |
# File 'lib/ronin/network/mixins/smtp.rb', line 49 parameter :smtp_login, :type => String, :description => 'SMTP authentication method' |
#smtp_password ⇒ Object
SMTP user to login with
57 58 |
# File 'lib/ronin/network/mixins/smtp.rb', line 57 parameter :smtp_password, :type => String, :description => 'SMTP password to login with' |
#smtp_password=(value) ⇒ Object
SMTP user to login with
57 58 |
# File 'lib/ronin/network/mixins/smtp.rb', line 57 parameter :smtp_password, :type => String, :description => 'SMTP password to login with' |
#smtp_session(options = {}) {|session| ... } ⇒ Object (protected)
Starts a session with the SMTP server. The host
, port
,
smtp_login
, smtp_user
and smtp_password
parameters
will also be used to connect to the server.
121 122 123 124 125 126 127 128 129 130 |
# File 'lib/ronin/network/mixins/smtp.rb', line 121 def smtp_session(={},&block) super(()) do |sess| yield sess if block_given? print_info "Logging out ..." end print_info "Disconnected to #{host_port}" return nil end |