Class: DoroParser::Parser::SMTP
- Inherits:
-
Object
- Object
- DoroParser::Parser::SMTP
- Defined in:
- lib/dorothy2/DEM.rb
Overview
todo to redo ##NEW PARSER CODED BY SALVATORE
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#hcmd ⇒ Object
readonly
Returns the value of attribute hcmd.
-
#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.
90 91 92 93 94 95 |
# File 'lib/dorothy2/DEM.rb', line 90 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.
60 61 62 |
# File 'lib/dorothy2/DEM.rb', line 60 def body @body end |
#hcmd ⇒ Object (readonly)
Returns the value of attribute hcmd.
58 59 60 |
# File 'lib/dorothy2/DEM.rb', line 58 def hcmd @hcmd end |
#hcont ⇒ Object (readonly)
Returns the value of attribute hcont.
59 60 61 |
# File 'lib/dorothy2/DEM.rb', line 59 def hcont @hcont end |
#rdata ⇒ Object
Returns the value of attribute rdata.
61 62 63 |
# File 'lib/dorothy2/DEM.rb', line 61 def rdata @rdata end |
Class Method Details
.body(data) ⇒ Object
65 66 67 68 |
# File 'lib/dorothy2/DEM.rb', line 65 def self.body(data) email = TMail::Mail.parse(data) return email end |
.hasbody?(data) ⇒ Boolean
76 77 78 79 80 |
# File 'lib/dorothy2/DEM.rb', line 76 def self.hasbody?(data) if data =~ /from(.*)From(.*)Subject/m return true end end |
.header?(data) ⇒ Boolean
70 71 72 73 74 |
# File 'lib/dorothy2/DEM.rb', line 70 def self.header?(data) if data =~ /(MAIL FROM: |EHLO |HELO |TO: |RSET)(.*)\n/ return true end end |
.response(data) ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/dorothy2/DEM.rb', line 82 def self.response(data) if data =~ /(\d*)(.*)\n/ rcode = $1 rcont = $2 return rcode, rcont end end |