Class: Keystone::Mail::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/keystone/mail__old/message.rb

Direct Known Subclasses

MessageIso2022jp, MessageSjis

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opt = {}) ⇒ Message

普通なことをしたいならTMailを使いましょう



12
13
14
15
# File 'lib/keystone/mail__old/message.rb', line 12

def initialize(opt={})
  @subject, @body, @mail_from_text = "", "", nil
  set_option(opt)
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



7
8
9
# File 'lib/keystone/mail__old/message.rb', line 7

def body
  @body
end

#mail_fromObject

Returns the value of attribute mail_from.



7
8
9
# File 'lib/keystone/mail__old/message.rb', line 7

def mail_from
  @mail_from
end

#mail_from_textObject

Returns the value of attribute mail_from_text.



7
8
9
# File 'lib/keystone/mail__old/message.rb', line 7

def mail_from_text
  @mail_from_text
end

#mail_toObject

Returns the value of attribute mail_to.



7
8
9
# File 'lib/keystone/mail__old/message.rb', line 7

def mail_to
  @mail_to
end

#subjectObject

Returns the value of attribute subject.



7
8
9
# File 'lib/keystone/mail__old/message.rb', line 7

def subject
  @subject
end

Instance Method Details

#set_option(opt) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/keystone/mail__old/message.rb', line 30

def set_option(opt)
  @subject = opt[:subject] if opt.key?(:subject)
  @body = opt[:body] if opt.key?(:body)
  @body = opt[:mail_to] if opt.key?(:mail_to)
  @body = opt[:mail_from] if opt.key?(:mail_from)
  @mail_from_text = opt[:mail_from_text] if opt.key?(:mail_from_text)
end

#to_srcObject



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/keystone/mail__old/message.rb', line 17

def to_src
  header = ""
  header += "Date: #{time2str(Time.now)}\n"
  header += create_mailfrom_header
  header += create_mailto_header
  header += create_subject_header
  header += "\n"
  e_body = encode_body
  header = header.encode(encode_body.encoding)
  header += e_body
  return header
end