Class: Rex::Proto::Sms::Model::Message
- Inherits:
-
Object
- Object
- Rex::Proto::Sms::Model::Message
- Defined in:
- lib/rex/proto/sms/model/message.rb
Instance Attribute Summary collapse
-
#from ⇒ String
The from field in the email.
-
#message ⇒ String
The text message.
-
#subject ⇒ String
The subject of the email.
-
#to ⇒ String
The to field in the email.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Rex::Proto::Sms::Model::Message
constructor
Initializes the SMTP object.
-
#to_s ⇒ String
Returns the raw SMS message.
Constructor Details
#initialize(opts = {}) ⇒ Rex::Proto::Sms::Model::Message
Initializes the SMTP object.
36 37 38 39 40 41 |
# File 'lib/rex/proto/sms/model/message.rb', line 36 def initialize(opts={}) self.from = opts[:from] self.to = opts[:to] self. = opts[:message] self.subject = opts[:subject] end |
Instance Attribute Details
#from ⇒ String
Returns The from field in the email.
17 18 19 |
# File 'lib/rex/proto/sms/model/message.rb', line 17 def from @from end |
#message ⇒ String
Returns The text message.
12 13 14 |
# File 'lib/rex/proto/sms/model/message.rb', line 12 def @message end |
#subject ⇒ String
Returns The subject of the email.
25 26 27 |
# File 'lib/rex/proto/sms/model/message.rb', line 25 def subject @subject end |
#to ⇒ String
Returns The to field in the email.
21 22 23 |
# File 'lib/rex/proto/sms/model/message.rb', line 21 def to @to end |
Instance Method Details
#to_s ⇒ String
Returns the raw SMS message
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/rex/proto/sms/model/message.rb', line 47 def to_s body = Rex::MIME::Message.new body.add_part(self., 'text/plain; charset=UTF-8', nil) sms = "MIME-Version: 1.0\n" sms << "From: #{self.from}\n" sms << "To: #{self.to}\n" sms << "Subject: #{self.subject}\n" sms << "Content-Type: multipart/alternative; boundary=#{body.bound}\n" sms << "\n" sms << body.to_s sms end |