Public Member Functions | |
| __construct () | |
| Initializes a new AnewtMailMessage instance. | |
| add_header ($name, $value) | |
| Adds a header to the message instance. | |
| get_header ($name) | |
| Returns the specified header. | |
| has_header ($name) | |
| Checks if a header is defined. | |
| send ($force=false) | |
| Sends the mail message. | |
Static Public Member Functions | |
| static | from_string ($data) |
| Creates a new message by parsing a string containing a complete mail message. | |
| static | from_stream ($stream) |
| Creates a new message by reading from a stream containing a complete mail message. | |
| static | from_file ($filename) |
| Creates a new message by reading from a file containing a complete mail message. | |
Private Member Functions | |
| parse_body ($body) | |
| Parses the raw body of a message and stores the result in this message. | |
| parse_headers ($headers) | |
| Parses raw headers and stores them in this message. | |
Private Attributes | |
| $headers | |
| Object holding all header data. | |
This class provides both functionality for reading and sending email messages.
Definition at line 25 of file mailmessage.lib.php.
| static AnewtMailMessage::from_string | ( | $ | data | ) | [static] |
Creates a new message by parsing a string containing a complete mail message.
The headers are parsed and stored; the body is left intact.
| $data | A string with a complete mail message |
Definition at line 39 of file mailmessage.lib.php.
| static AnewtMailMessage::from_stream | ( | $ | stream | ) | [static] |
Creates a new message by reading from a stream containing a complete mail message.
The headers are parsed and stored; the body is left intact.
| $stream | An open stream resource, eg. from fopen() |
Definition at line 72 of file mailmessage.lib.php.
| static AnewtMailMessage::from_file | ( | $ | filename | ) | [static] |
Creates a new message by reading from a file containing a complete mail message.
The headers are parsed and stored; the body is left intact.
| $filename | The filename of the file to read |
Definition at line 89 of file mailmessage.lib.php.
| AnewtMailMessage::parse_body | ( | $ | body | ) | [private] |
Parses the raw body of a message and stores the result in this message.
This method should only be called once during parsing. Bodies that are encoded using as 'quoted-printable' are converted to normal strings.
| $body | A string that contains the body text |
Definition at line 130 of file mailmessage.lib.php.
| AnewtMailMessage::add_header | ( | $ | name, | |
| $ | value | |||
| ) |
Adds a header to the message instance.
If the header already existed, the value is converted to an array and the new values is appended.
| $name | The name of the header | |
| $value | The value of the header |
Definition at line 154 of file mailmessage.lib.php.
| AnewtMailMessage::get_header | ( | $ | name | ) |
Returns the specified header.
| $name | The name of the header |
Definition at line 184 of file mailmessage.lib.php.
| AnewtMailMessage::has_header | ( | $ | name | ) |
Checks if a header is defined.
| $name | The name of the header |
Definition at line 199 of file mailmessage.lib.php.
| AnewtMailMessage::parse_headers | ( | $ | headers | ) | [private] |
Parses raw headers and stores them in this message.
This method should only be called once during parsing.
| $headers | A string or array that contains the headers to be parsed |
Ignore "^From .* if it's the first line (mbox)
Definition at line 211 of file mailmessage.lib.php.
| AnewtMailMessage::send | ( | $ | force = false |
) |
Sends the mail message.
This method tries to use the sendmail binary directly (falls back to the PHP mail() function) to actually send the message. Note that only messages which have the 'can-send' attribute set to true are considered for sending. Messages that were parsed from a file, stream or a string (using the static methods of this class) will have this attribute set to false, because sending a message you just parsed is not generally what you want.
| $force | Optional parameter to force sending of non-sendable messages |
Definition at line 287 of file mailmessage.lib.php.
1.5.9