MailMessage
From Fernseher
Revision as of 23:37, 22 January 2009 by 96.42.70.86 (talk) (New page: This class represents a Mail Message for the Modjs environment, a straight up MIME message that, when receive processing is performed on it, gets converted from strict MIME RFC-204...)
This class represents a Mail Message for the Modjs environment, a straight up MIME message that, when receive processing is performed on it, gets converted from strict MIME RFC-2045 compliant encodings and line foldings and whatnot, and when send processing is performed, gets converted to strict MIME RFC-2045 compliant encodings, line foldings, etc. It is mostly a wrapper around MimeEntity, with an additional property to help determine current encoding state, and several methods for encoding/decoding purposes.
To create a new MailMessage:
msg = new MailMessage(MimeEntity)
- Creates a mail message with the specified entity in it and converts to RFC-2045 compliant message string.
msg = new MailMessage(textblob)
- Creates a mail message with the specified textblob in it. This gets decoded and parsed into a MimeEntity.
Properties in MailMessages:
- entity: The MimeEntity, decoded and everything, ready to be looked at and analyzed.
- mailable: The textblob, encoded and ready to be mailed out.
Extra methods:
- msg.encode(): Encodes the entity to the mailable property.
- msg.decode(): Decodes the mailable text blob back into the entity
- status = msg.send([path and args string]): Calls msg.encode() and executes '/usr/bin/mail -t' (or the path argument and args) in a ProcessConnection() object, and then sends along the mailable textblob to it, followed by an EOF and then close() and returns the exit status.