Class: DoroParser::Parser::SMTP

Inherits:
Object
  • Object
show all
Defined in:
lib/dorothy2/DEM.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(a) ⇒ SMTP

Returns a new instance of SMTP.



159
160
161
162
163
164
165
166
# File 'lib/dorothy2/DEM.rb', line 159

def initialize a 
  
  if a =~ /(MAIL FROM: |EHLO |HELO |TO: |RSET)(.*)\n/
    @hcmd = $1
    @hcont = $2
  end
  
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



123
124
125
# File 'lib/dorothy2/DEM.rb', line 123

def body
  @body
end

#hcmdObject (readonly)

todo make a initialize class



121
122
123
# File 'lib/dorothy2/DEM.rb', line 121

def hcmd
  @hcmd
end

#hcontObject (readonly)

Returns the value of attribute hcont.



122
123
124
# File 'lib/dorothy2/DEM.rb', line 122

def hcont
  @hcont
end

#rdataObject

Returns the value of attribute rdata.



124
125
126
# File 'lib/dorothy2/DEM.rb', line 124

def rdata
  @rdata
end

Class Method Details

.body(data) ⇒ Object



126
127
128
129
130
131
# File 'lib/dorothy2/DEM.rb', line 126

def self.body(data)
  
  email = TMail::Mail.parse(data)
  return email 
  
end

.hasbody?(data) ⇒ Boolean

Returns:

  • (Boolean)


141
142
143
144
145
146
147
# File 'lib/dorothy2/DEM.rb', line 141

def self.hasbody?(data)

if data =~ /from(.*)From(.*)Subject/m
  return true
end

end

.header?(data) ⇒ Boolean

Returns:

  • (Boolean)


133
134
135
136
137
138
139
# File 'lib/dorothy2/DEM.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/DEM.rb', line 149

def self.response(data)

if data =~ /(\d*)(.*)\n/
  rcode = $1
  rcont = $2
  return rcode, rcont
end

end