Representation of an email message.
Representation of an email message.
This class provides both functionality for reading and sending email messages.
Header/body formatting so that it can be used correctly to output a complete mail message.
What to do with multipart messages?
What to do with different encodings?
static 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.
$dataA string with a complete mail message
A new AnewtMailMessage instance
static 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.
$streamAn open stream resource, eg. from fopen()
A new AnewtMailMessage instance
static 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.
$filenameThe filename of the file to read
A new AnewtMailMessage instance
__construct() ¶Initializes a new AnewtMailMessage instance.
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.
$nameThe name of the header
$valueThe value of the header
get_header($name) ¶Returns the specified header.
$nameThe name of the header
A string containing the header value or an array containing multiple string values (if the header occurred more than once)
has_header($name) ¶Checks if a header is defined.
$nameThe name of the header
True if the header was found, false otherwise
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.
$forceOptional parameter to force sending of non-sendable messages
True if the message was sent successfully, false if an error occurred
Handle name/address rfc822 addresses correctly
Include all headers instead of just a few
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.
$bodyA string that contains the body text
parse_headers($headers) [private] ¶Parses raw headers and stores them in this message.
This method should only be called once during parsing.
$headersA string or array that contains the headers to be parsed
AnewtContainer::_to_array()AnewtContainer::_add()AnewtContainer::delete()AnewtContainer::get()AnewtContainer::_isset()AnewtContainer::_seed()AnewtContainer::setdefault()AnewtContainer::getdefault()AnewtContainer::set()AnewtContainer::__isset()AnewtContainer::__set()AnewtContainer::__construct()AnewtContainer::is_set()AnewtContainer::add()AnewtContainer::_getdefault()AnewtContainer::__unset()AnewtContainer::seed()AnewtContainer::to_array()AnewtContainer::_get()AnewtContainer::__get()AnewtContainer::keys()AnewtContainer::clear()AnewtContainer::_keys()AnewtContainer::_set()