Module: Ronin::Network::SMTP
- Included in:
- Net, ESMTP, Mixins::SMTP, Support
- Defined in:
- lib/ronin/network/smtp/smtp.rb,
lib/ronin/network/smtp/email.rb
Overview
Provides helper methods for communicating with SMTP services.
Defined Under Namespace
Classes: Email
Constant Summary
- DEFAULT_PORT =
Default SMTP port
25
Class Method Summary (collapse)
-
+ (Integer) default_port
The default Ronin SMTP port.
-
+ (Object) default_port=(port)
Sets the default Ronin SMTP port.
-
+ (String) message(options = {}) {|email| ... }
Creates a properly formatted email.
Instance Method Summary (collapse)
-
- (Net::SMTP) smtp_connect(host, options = {}) {|session| ... }
Creates a connection to the SMTP server.
-
- (Object) smtp_message(options = {}) {|email| ... }
Creates a new email message.
- - (Object) smtp_send_message(host, options = {}) {|email| ... }
-
- (Object) smtp_session(host, options = {}) {|session| ... }
Starts a session with the SMTP server.
Class Method Details
+ (Integer) default_port
The default Ronin SMTP port.
39 40 41 |
# File 'lib/ronin/network/smtp/smtp.rb', line 39 def SMTP.default_port @default_port ||= DEFAULT_PORT end |
+ (Object) default_port=(port)
Sets the default Ronin SMTP port.
51 52 53 |
# File 'lib/ronin/network/smtp/smtp.rb', line 51 def SMTP.default_port=(port) @default_port = port end |
+ (String) message(options = {}) {|email| ... }
Creates a properly formatted email.
72 73 74 |
# File 'lib/ronin/network/smtp/smtp.rb', line 72 def SMTP.(={},&block) Email.new(,&block).to_s end |
Instance Method Details
- (Net::SMTP) smtp_connect(host, options = {}) {|session| ... }
Creates a connection to the SMTP server.
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/ronin/network/smtp/smtp.rb', line 135 def smtp_connect(host,={}) host = host.to_s port = ([:port] || SMTP.default_port) helo = [:helo] auth = [:auth] user = [:user] password = [:password] session = Net::SMTP.start(host,port,helo,user,password,auth) yield session if block_given? return session end |
- (Object) smtp_message(options = {}) {|email| ... }
Creates a new email message.
92 93 94 |
# File 'lib/ronin/network/smtp/smtp.rb', line 92 def (={},&block) Email.new(,&block) end |
- (Object) smtp_send_message(host, options = {}) {|email| ... }
222 223 224 225 226 227 228 |
# File 'lib/ronin/network/smtp/smtp.rb', line 222 def (host,={},&block) email = (,&block) smtp_session(host,) do |smtp| smtp.(email.to_s, email.from, email.to) end end |
- (Object) smtp_session(host, options = {}) {|session| ... }
Starts a session with the SMTP server.
176 177 178 179 180 181 182 183 |
# File 'lib/ronin/network/smtp/smtp.rb', line 176 def smtp_session(host,={}) session = smtp_connect(host,) yield session if block_given? session.finish return nil end |