Class: Rex::Proto::Mms::Model::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/proto/mms/model/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Rex::Proto::Mms::Model::Message

Initializes the SMTP object.

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :from (String)
  • :to (String)
  • :message (String)
  • :content_type (String)
  • :attachment_path (String)

48
49
50
51
52
53
54
55
56
57
58
# File 'lib/rex/proto/mms/model/message.rb', line 48

def initialize(opts={})
  self.from = opts[:from]
  self.to = opts[:to]
  self.message = opts[:message]
  self.subject = opts[:subject]
  self.content_type = opts[:content_type]
  if opts[:attachment_path]
    self.attachment = load_file_to_base64(opts[:attachment_path])
    self.attachment_name = File.basename(opts[:attachment_path])
  end
end

Instance Attribute Details

#attachmentString

Returns The loaded attachment converted to Base64.

Returns:

  • (String)

    The loaded attachment converted to Base64


19
20
21
# File 'lib/rex/proto/mms/model/message.rb', line 19

def attachment
  @attachment
end

#attachment_nameString

Returns The attachment base name extracted from :attachment.

Returns:

  • (String)

    The attachment base name extracted from :attachment


35
36
37
# File 'lib/rex/proto/mms/model/message.rb', line 35

def attachment_name
  @attachment_name
end

#content_typeFixnum

Returns The content type of the attachment.

Returns:

  • (Fixnum)

    The content type of the attachment


15
16
17
# File 'lib/rex/proto/mms/model/message.rb', line 15

def content_type
  @content_type
end

#fromString

Returns The from field in the email.

Returns:

  • (String)

    The from field in the email


23
24
25
# File 'lib/rex/proto/mms/model/message.rb', line 23

def from
  @from
end

#messageString

Returns The text message.

Returns:

  • (String)

    The text message


11
12
13
# File 'lib/rex/proto/mms/model/message.rb', line 11

def message
  @message
end

#subjectString

Returns The subject of the email.

Returns:

  • (String)

    The subject of the email


31
32
33
# File 'lib/rex/proto/mms/model/message.rb', line 31

def subject
  @subject
end

#toString

Returns The to field in the email.

Returns:

  • (String)

    The to field in the email


27
28
29
# File 'lib/rex/proto/mms/model/message.rb', line 27

def to
  @to
end

Instance Method Details

#to_sString

Returns the raw MMS message

Returns:

  • (String)

64
65
66
# File 'lib/rex/proto/mms/model/message.rb', line 64

def to_s
  generate_mms_message
end