Class: DoroParser::Parser::SMTP

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

Overview

todo to redo

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(a) ⇒ SMTP

Returns a new instance of SMTP.



88
89
90
91
92
93
# File 'lib/dorothy2/DEM.rb', line 88

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.



60
61
62
# File 'lib/dorothy2/DEM.rb', line 60

def body
  @body
end

#hcmdObject (readonly)

Returns the value of attribute hcmd.



58
59
60
# File 'lib/dorothy2/DEM.rb', line 58

def hcmd
  @hcmd
end

#hcontObject (readonly)

Returns the value of attribute hcont.



59
60
61
# File 'lib/dorothy2/DEM.rb', line 59

def hcont
  @hcont
end

#rdataObject

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



63
64
65
66
# File 'lib/dorothy2/DEM.rb', line 63

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

.hasbody?(data) ⇒ Boolean

Returns:

  • (Boolean)


74
75
76
77
78
# File 'lib/dorothy2/DEM.rb', line 74

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

.header?(data) ⇒ Boolean

Returns:

  • (Boolean)


68
69
70
71
72
# File 'lib/dorothy2/DEM.rb', line 68

def self.header?(data)
  if data =~ /(MAIL FROM: |EHLO |HELO |TO: |RSET)(.*)\n/
    return true
  end
end

.response(data) ⇒ Object



80
81
82
83
84
85
86
# File 'lib/dorothy2/DEM.rb', line 80

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