Class: DoroParser::Parser::SMTP
- Inherits:
-
Object
- Object
- DoroParser::Parser::SMTP
- Defined in:
- lib/dorothy2/do-parsers.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#hcmd ⇒ Object
readonly
todo make a initialize class.
-
#hcont ⇒ Object
readonly
Returns the value of attribute hcont.
-
#rdata ⇒ Object
Returns the value of attribute rdata.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(a) ⇒ SMTP
constructor
A new instance of SMTP.
Constructor Details
#initialize(a) ⇒ SMTP
Returns a new instance of SMTP.
159 160 161 162 163 164 165 166 |
# File 'lib/dorothy2/do-parsers.rb', line 159 def initialize a if a =~ /(MAIL FROM: |EHLO |HELO |TO: |RSET)(.*)\n/ @hcmd = $1 @hcont = $2 end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
123 124 125 |
# File 'lib/dorothy2/do-parsers.rb', line 123 def body @body end |
#hcmd ⇒ Object (readonly)
todo make a initialize class
121 122 123 |
# File 'lib/dorothy2/do-parsers.rb', line 121 def hcmd @hcmd end |
#hcont ⇒ Object (readonly)
Returns the value of attribute hcont.
122 123 124 |
# File 'lib/dorothy2/do-parsers.rb', line 122 def hcont @hcont end |
#rdata ⇒ Object
Returns the value of attribute rdata.
124 125 126 |
# File 'lib/dorothy2/do-parsers.rb', line 124 def rdata @rdata end |
Class Method Details
.body(data) ⇒ Object
126 127 128 129 130 131 |
# File 'lib/dorothy2/do-parsers.rb', line 126 def self.body(data) email = TMail::Mail.parse(data) return email end |
.hasbody?(data) ⇒ Boolean
141 142 143 144 145 146 147 |
# File 'lib/dorothy2/do-parsers.rb', line 141 def self.hasbody?(data) if data =~ /from(.*)From(.*)Subject/m return true end end |
.header?(data) ⇒ Boolean
133 134 135 136 137 138 139 |
# File 'lib/dorothy2/do-parsers.rb', line 133 def self.header?(data) if data =~ /(MAIL FROM: |EHLO |HELO |TO: |RSET)(.*)\n/ return true end end |
.response(data) ⇒ Object
149 150 151 152 153 154 155 156 157 |
# File 'lib/dorothy2/do-parsers.rb', line 149 def self.response(data) if data =~ /(\d*)(.*)\n/ rcode = $1 rcont = $2 return rcode, rcont end end |