Class: Percolate::MailObject
- Inherits:
-
Object
- Object
- Percolate::MailObject
- Defined in:
- lib/percolate/mail_object.rb
Overview
The SMTP::MailObject is mostly a class. It’s what is produced by the Percolate::SMTP::Responder class as a result of a complete SMTP transaction.
Instance Attribute Summary collapse
-
#content ⇒ Object
You get to fiddle with these.
-
#envelope_from ⇒ Object
You get to fiddle with these.
-
#envelope_to ⇒ Object
You get to fiddle with these.
-
#heloname ⇒ Object
readonly
These four are read-only because I hate you.
-
#myhostname ⇒ Object
readonly
These four are read-only because I hate you.
-
#origin_ip ⇒ Object
readonly
These four are read-only because I hate you.
-
#smtp_id ⇒ Object
readonly
These four are read-only because I hate you.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ MailObject
constructor
The constructor.
Constructor Details
#initialize(opts = {}) ⇒ MailObject
The constructor. It takes a whole bunch of optional keyword-style parameters. View source for more details–I hope they’re self- explanatory. If they’re not, I need to come up with better names for them.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/percolate/mail_object.rb', line 42 def initialize(opts = {}) @envelope_from = opts[:envelope_from] @envelope_to = opts[:envelope_to] @content = opts[:content] @origin_ip = opts[:origin_ip] @heloname = opts[:heloname] @myhostname = opts[:myhostname] @timestamp = Time.now @smtp_id = ([nil]*16).map { rand(16).to_s(16) }.join.upcase end |
Instance Attribute Details
#content ⇒ Object
You get to fiddle with these. The SMTP standard probably has some mumbling about this data being sacrosanct, but then again, it also says that “content” can contain anything at all and you still have to accept it (and presumably, later try to reconstruct it into an actual email message). So hey, have fun!
Also, at the time of creation, the responder doesn’t know necessarily who a message is meant for. Heck, it could be meant for twenty different people!
63 64 65 |
# File 'lib/percolate/mail_object.rb', line 63 def content @content end |
#envelope_from ⇒ Object
You get to fiddle with these. The SMTP standard probably has some mumbling about this data being sacrosanct, but then again, it also says that “content” can contain anything at all and you still have to accept it (and presumably, later try to reconstruct it into an actual email message). So hey, have fun!
Also, at the time of creation, the responder doesn’t know necessarily who a message is meant for. Heck, it could be meant for twenty different people!
63 64 65 |
# File 'lib/percolate/mail_object.rb', line 63 def envelope_from @envelope_from end |
#envelope_to ⇒ Object
You get to fiddle with these. The SMTP standard probably has some mumbling about this data being sacrosanct, but then again, it also says that “content” can contain anything at all and you still have to accept it (and presumably, later try to reconstruct it into an actual email message). So hey, have fun!
Also, at the time of creation, the responder doesn’t know necessarily who a message is meant for. Heck, it could be meant for twenty different people!
63 64 65 |
# File 'lib/percolate/mail_object.rb', line 63 def envelope_to @envelope_to end |
#heloname ⇒ Object (readonly)
These four are read-only because I hate you. They’re actually read-only because PRESUMABLY the guy creating an object of this type (namely, the responder), knows all this information at its own creation, let alone when it eventually gets around to building a MailObject object.
70 71 72 |
# File 'lib/percolate/mail_object.rb', line 70 def heloname @heloname end |
#myhostname ⇒ Object (readonly)
These four are read-only because I hate you. They’re actually read-only because PRESUMABLY the guy creating an object of this type (namely, the responder), knows all this information at its own creation, let alone when it eventually gets around to building a MailObject object.
70 71 72 |
# File 'lib/percolate/mail_object.rb', line 70 def myhostname @myhostname end |
#origin_ip ⇒ Object (readonly)
These four are read-only because I hate you. They’re actually read-only because PRESUMABLY the guy creating an object of this type (namely, the responder), knows all this information at its own creation, let alone when it eventually gets around to building a MailObject object.
70 71 72 |
# File 'lib/percolate/mail_object.rb', line 70 def origin_ip @origin_ip end |
#smtp_id ⇒ Object (readonly)
These four are read-only because I hate you. They’re actually read-only because PRESUMABLY the guy creating an object of this type (namely, the responder), knows all this information at its own creation, let alone when it eventually gets around to building a MailObject object.
70 71 72 |
# File 'lib/percolate/mail_object.rb', line 70 def smtp_id @smtp_id end |