class Net::ItemOfMail

Public Class Methods

new(local_port, local_hostname, remote_port, remote_hostname, remote_ip) click to toggle source
# File lib/net/item_of_mail.rb, line 21
def initialize(local_port, local_hostname, remote_port, remote_hostname, remote_ip)
  self[:local_port] = local_port
  self[:local_hostname] = local_hostname
  self[:remote_port] = remote_port
  self[:remote_hostname] = remote_hostname
  self[:remote_ip] = remote_ip

  new_id = []
  new_id[0] = Time.now.tv_sec.to_s(36).upcase
  new_id[1] = ("000000"+(2176782336*rand).to_i.to_s(36))[-6..-1].upcase
  new_id[2] = ("00"+(Time.now.usec/1000).to_i.to_s(36))[-2..-1].upcase
  self[:id] = new_id.join("-")

  self[:time] = Time.now.strftime("%Y-%m-%d %H:%M:%S %z")
end

Public Instance Methods

reconstituted_email() click to toggle source
# File lib/net/item_of_mail.rb, line 37
def reconstituted_email
  text = []
  self[:data][:headers].each { |k,v| text << "#{v}" }
  text.concat(self[:data][:text])
  text.join(CRLF)+CRLF
end