Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
Mime

Functions

 __call ($name, $arguments)
 Handle deprecated methods.
 
static __callStatic ($name, $arguments)
 Handle deprecated static methods.
 
 __clone ()
 Function to run on clone.
 
 __construct ( $name, $value)
 Constructor.
 
 __construct ($id)
 Constructor.
 
 __construct ()
 Constructor.
 
 __construct (Horde_Mime_Headers $headers)
 Constructor.
 
 __construct (Horde_Mime_Part $mime_part)
 Constructor.
 
 __construct (Horde_Mime_Part $part, $base=false)
 Constructor.
 
 __get ($name)
 
 __serialize ()
 Serialization.
 
 __toString ()
 
 __unserialize (array $data)
 Unserialization.
 
 _cidReplace ($node, $attribute, $callback)
 
 _encode ($name, $val, $opts)
 
 _escapeParams ($params)
 Escape the parameter array.
 
static _findBoundary ($text, $pos, $boundary, $end=null)
 Find the location of the next boundary string.
 
static _findHeader ($text, $eol)
 Find the location of the end of the header text.
 
 _getHeaderClassName ($header)
 Return the header class to use for a header name.
 
static _getMimeExtensionMap ()
 Returns a copy of the MIME extension map.
 
static _getStructure ($header, $body, array $opts=array())
 Creates a MIME object from the text of one part of a MIME message.
 
 _getTransferEncoding ($encode=self::ENCODE_7BIT)
 Get the transfer encoding for the part based on the user requested transfer encoding and the current contents of the part.
 
 _idArithmetic ($id, $action, $options)
 
 _readStream ($fp, $close=false)
 Read data from a stream.
 
 _reEncodeMessageAttachment (Horde_Mime_Part $part)
 Rebuilds $part and forces it to be a base64 encoded application/octet-stream part.
 
 _reindex ($force=false)
 Reindexes the MIME IDs, if necessary.
 
 _rfc822ParseMimeToken (&$str)
 
 _sanityCheck ($data)
 Perform sanity checking on a header value.
 
 _sanityCheckRfc822Attachments ()
 Re-enocdes message/rfc822 parts in case there was e.g., some broken line length in the headers of the message in the part.
 
 _scanStream ($fp)
 Scans a stream for content type.
 
 _sendEncode ( $opts)
 TODO.
 
 _setValue ( $value)
 TODO.
 
 _transferDecode ($fp, $encoding)
 Decodes the contents of the part to binary encoding.
 
 _transferEncode ($fp, $encoding)
 Encodes the contents of the part as necessary for transport.
 
 _uudecode ($input)
 PHP 5's built-in convert_uudecode() is broken.
 
 _writeStream ($data, $options=array())
 Write data to a stream.
 
 addAttachment ($file, $name=null, $type=null, $charset='us-ascii')
 Adds an attachment.
 
 addHeader ($header, $value, $overwrite=null)
 Adds a message header.
 
 addHeader ($header, $value, array $opts=array())
 Add/append/replace a header.
 
 addHeaderOb (Horde_Mime_Headers_Element $ob)
 Add a Horde_Mime_Headers_Element object to the current header list.
 
 addHeaderOb (Horde_Mime_Headers_Element $ob, $check=false)
 Add a Horde_Mime_Headers_Element object to the current header list.
 
 addHeaders ($headers=array())
 Adds several message headers at once.
 
 addMdnRequestHeaders ($to)
 Add a MDN (read receipt) request header.
 
 addMessageIdHeader ()
 
 addMimeHeaders ($options=array())
 Returns a Horde_Mime_Header object containing all MIME headers needed for the part.
 
 addMimePart ($part)
 Adds a MIME message part.
 
 addPart ($mime_part)
 
 addPart ($mime_type, $content, $charset='us-ascii', $disposition=null)
 Adds a message part.
 
 addReceivedHeader (array $opts=array())
 
 addRecipients ($recipients)
 Adds message recipients.
 
 addressFields ()
 
 addUserAgentHeader ()
 
 alterPart ($id, $mime_part)
 
static analyzeData ($data, $magic_db=null, $opts=array())
 Attempt to determine the MIME type of an unknown byte stream.
 
static analyzeFile ($path, $magic_db=null, $opts=array())
 Attempt to determine the MIME type of an unknown file.
 
 appendContents ($contents, $options=array())
 Add to the body contents of this part.
 
 buildMimeIds ($id=null, $rfc822=false)
 Build the MIME IDs for this part and all subparts.
 
 cidReplace ($text, $callback, $charset='UTF-8')
 Scan for CID strings in HTML data and replace with data returned from a callback method.
 
 cidSearch ($cid)
 Search for a CID in the related part.
 
 clearContents ()
 Clears the body contents of this part.
 
 clearContentTypeParameter ($label)
 
 clearParts ()
 Removes all (additional) message parts but leaves the body parts untouched.
 
 clearRecipients ()
 Removes all message recipients.
 
 contentTypeMap ($sort=true)
 
 count ()
 Returns the number of child message parts (doesn't include grandchildren or more remote ancestors).
 
static create ()
 Creates a default Content-Type header, conforming to the MIME specification as detailed in RFC 2045.
 
 current ()
 
static decode ($string)
 Decodes a MIME encoded (RFC 2047) string.
 
static decodeParam ($type, $data)
 
static doSendEncode ($alist, array $opts=array())
 Do send encoding for addresses.
 
static encode ($text, $charset='UTF-8')
 MIME encodes a string (RFC 2047).
 
static encode ($text, $eol="\n", $wrap=76)
 Encodes text via quoted-printable encoding.
 
 encode (array $opts=array())
 Encodes a MIME content parameter string pursuant to RFC 2183 & 2231 (Content-Type and Content-Disposition headers).
 
static encodeParam ($name, $val, array $opts=array())
 
static extToMime ($ext)
 Attempt to convert a file extension to a MIME type, based on the global Horde and application specific config files.
 
static filenameToMime ($filename, $unknown=true)
 Attempt to convert a filename to a MIME type, based on the global Horde and application specific config files.
 
 filter ($in, $out, &$consumed, $closing)
 
 findBody ($subtype=null)
 Finds the main "body" text part (if any) in a message.
 
 generate ($action, $sending, $type, $name, $mailer, array $opts=array(), array $mod=array(), array $err=array())
 Generate the MDN according to the specifications listed in RFC 3798 [3].
 
static generateMessageId ()
 
 getAddressList ($first=false)
 
 getAllContentTypeParameters ()
 Get all parameters from the Content-Type header.
 
 getAllDispositionParameters ()
 Get all parameters from the Content-Disposition header.
 
 getBasePart ()
 Return the base MIME part.
 
 getBytes ($approx=false)
 Determine the size of this MIME part and its child members.
 
 getCharset ()
 Get the character set to use for this part.
 
 getChildren ()
 
 getContentId ()
 Returns the Content-ID for this part.
 
 getContents ($options=array())
 Return the body of the part.
 
 getContentTypeParameter ($label)
 Get a content type parameter from this part.
 
 getDefaultType ()
 If the subtype of a MIME part is unrecognized by an application, the default type should be used instead (See RFC 2046).
 
 getDescription ($default=false)
 Get the description of this part.
 
 getDisposition ()
 Get the content-disposition of this part.
 
 getDispositionParameter ($label)
 Get a disposition parameter from this part.
 
 getDuration ()
 Get the content duration of the data contained in this part (see RFC 3803).
 
 getEOL ()
 Get the string to use for EOLs.
 
static getHandles ()
 
 getHeader ($header)
 Get a header from the header array.
 
 getHeaderCharset ()
 Get the character set to use when outputting MIME headers.
 
 getIterator ()
 
 getLanguage ()
 Get the language(s) of this part.
 
 getMdnReturnAddr ()
 Returns the address(es) to return the MDN to.
 
 getMetadata ($key)
 Retrieves metadata from this object.
 
 getMimeId ()
 Returns the MIME ID of this part.
 
 getName ($default=false)
 Get the name of this part.
 
 getOb ($field)
 
 getPart ($id)
 
 getPartByIndex ($index)
 Returns a subpart by index.
 
 getParts ()
 Get a list of all MIME subparts.
 
 getPrimaryType ()
 Get the primary type of this part.
 
 getRaw ($stream=true)
 Get the raw email data sent by this object.
 
static getRawPartText ($text, $type, $id)
 Attempts to obtain the raw text of a MIME part.
 
 getSize ($approx=false)
 Output the size of this MIME part in KB.
 
 getString ($header)
 
 getSubType ()
 Get the subtype of this part.
 
 getType ($charset=false)
 Get the full MIME Content-Type of this part.
 
 getUserAgent ()
 
 getValue ($header, $type=Horde_Mime_Headers::VALUE_STRING)
 
 hasChildren ()
 
 idArithmetic ($action, array $options=array())
 Performs MIME ID "arithmetic".
 
static is8bit ($string, $charset=null)
 Determines if a string contains 8-bit (non US-ASCII) characters.
 
static isAtextNonTspecial ($c)
 Determine if character is a non-escaped element in MIME parameter data (See RFC 2045 [Appendix A]).
 
 isAttachment ()
 Determines if this MIME part is an attachment for display purposes.
 
 isBasePart ($base)
 Is this the base MIME part?
 
static isChild ($base, $id)
 
 isChild ($id)
 Determines if a given MIME ID lives underneath a base ID.
 
 isDefault ()
 If true, indicates the contents of the header is the default value.
 
 key ()
 
 listHeaders ()
 
 listHeadersExist ()
 
static mimeIdArithmetic ($id, $action, $options=array())
 
 mimeParamFields ()
 
static mimeToExt ($type)
 Attempt to convert a MIME type to a file extension, based on the global Horde and application specific config files.
 
 next ()
 
 offsetExists ($offset)
 Does header exist?
 
 offsetGet ($offset)
 Return header element object.
 
 offsetSet ($offset, $value)
 Store a header element object.
 
 offsetUnset ($offset)
 Remove a header element object.
 
 onCreate ()
 
 originalMessageText ($text)
 When generating the MDN, should we return the enitre text of the original message? The default is no - we only return the headers of the original message.
 
static parseHeaders ($text)
 Builds a Horde_Mime_Headers object from header text.
 
static parseMessage ($text, array $opts=array())
 Attempts to build a Horde_Mime_Part object from message text.
 
 partIterator ($current=true)
 Returns the recursive iterator needed to iterate through this part.
 
static quotedPrintableEncode ($text, $eol=self::EOL, $wrap=76)
 
 removeHeader ($header)
 Remove a header from the header array.
 
 removePart ($part)
 Removes a message part.
 
 removeRecipients ($recipients)
 Removes message recipients.
 
 replaceEOL ($text, $eol=null, $stream=false)
 Replace newlines in this part's contents with those specified by either the given newline sequence or the part's current EOL setting.
 
 replaceHeader ($header, $value, array $opts=array())
 
 rewind ()
 
 send ($email, $headers, Horde_Mail_Transport $mailer, array $opts=array())
 Sends this message.
 
 send ($mailer, $resend=false, $flowed=true)
 Sends this message.
 
 sendEncode (array $opts=array())
 Returns the encoded string value(s) needed when sending the header text to a RFC compliant mail submission server.
 
 serialize ()
 Serialization.
 
 setBasePart ($part)
 Sets the base MIME part.
 
 setBody ($body, $charset=null, $wrap=false)
 Sets the message body text.
 
 setBytes ($bytes)
 Explicitly set the size (in bytes) of this part.
 
 setCharset ($charset)
 Set the character set of this part.
 
 setContentId ($cid=null)
 Sets the Content-ID header for this part.
 
 setContentParamValue ($data)
 Set the content-parameter base value.
 
 setContents ($contents, $options=array())
 Set the body contents of this part.
 
 setContentTypeParameter ($label, $data)
 Add/remove a content type parameter to this part.
 
 setDescription ($description)
 Set the description of this part.
 
 setDisposition ($disposition=null)
 Set the content-disposition of this part.
 
 setDispositionParameter ($label, $data)
 Add a disposition parameter to this part.
 
 setDuration ($duration)
 Set the content duration of the data contained in this part (see RFC 3803).
 
 setEOL ( $eol)
 Sets a new string to use for EOLs.
 
 setHeaderCharset ($charset)
 Set the character set to use when outputting MIME headers.
 
 setHtmlBody ($body, $charset=null, $alternative=true)
 Sets the HTML message body text.
 
 setLanguage ($lang)
 Set the language(s) of this part.
 
 setMetadata ($key, $data=null)
 Set a piece of metadata on this object.
 
 setMimeId ($mimeid)
 Alter the MIME ID of this part.
 
 setName ($name)
 Set the name of this part.
 
 setTransferEncoding ($encoding, $options=array())
 Set the transfer encoding to use for this part.
 
 setType ($type)
 Set the MIME type of this part.
 
 setUserAgent ($agent)
 
 setValue ($value)
 Set the value of the header.
 
 singleFields ($list=true)
 
 startId ()
 Return the start ID.
 
 toArray (array $opts=array())
 Returns the headers in array format.
 
 toString ($options=array())
 Return the entire part in MIME format.
 
 toString (array $opts=array())
 Returns all headers concatenated into a single string.
 
 unserialize ($data)
 Unserialization.
 
 userConfirmationNeeded ()
 Is user input required to send the MDN? Explicit confirmation is needed in some cases to prevent mail loops and the use of MDNs for mail bombing.
 
static uudecode ($input)
 
 valid ()
 

Variables

Horde_Mime_Part $_base
 The base MIME part.
 
string $_bcc
 Bcc recipients.
 
Horde_Mime_Part $_body
 The main body part.
 
integer $_bytes
 Default value for this Part's size.
 
string $_charset = 'UTF-8'
 The charset to use for the message.
 
resource $_contents
 The body of the part.
 
array $_data = array()
 Uudecode data.
 
 $_eol = "\n"
 
string $_eol = self::EOL
 The sequence to use as EOL for this part.
 
boolean $_failed = false
 Flag to detect if a message failed to send at least once.
 
static array $_handlers = array()
 Cached handler information for Header Element objects.
 
string $_hdrCharset = null
 The charset to output the headers in.
 
Horde_Support_CaseInsensitiveArray $_headers
 The internal headers array.
 
Horde_Mime_Headers $_headers
 The Horde_Mime_Headers object.
 
Horde_Mime_Headers $_headers
 The MIME headers for this part.
 
Horde_Mime_Part $_htmlBody
 The main HTML body part.
 
string $_mailer_driver = 'smtp'
 The Mail driver name.
 
array $_mailer_params = array()
 The Mail driver parameters.
 
array $_metadata = array()
 Metadata.
 
string $_mimeid = null
 The MIME ID of this part.
 
string $_msgtext = false
 The text of the original message.
 
Horde_Mime_Part $_part
 Base part.
 
array $_parts = array()
 All MIME parts except the main body part.
 
array $_parts = array()
 The subparts of this part.
 
static string $_pearDirectory = '@data_dir@'
 The absolute PEAR path to the translations for the default gettext handler.
 
Horde_Mail_Rfc822_List $_recipients
 The message recipients.
 
string $_start
 Start ID.
 
object $_state
 State data.
 
integer $_status = 0
 Status mask for this part.
 
array $_temp = array()
 Temporary array.
 
string $_transferEncoding = self::DEFAULT_ENCODING
 The desired transfer encoding of this part.
 
array $_values = array()
 Header values.
 
static $brokenRFC2231 = false
 
static boolean $decodeWindows1252 = true
 Use windows-1252 charset when decoding ISO-8859-1 data? HTML 5 requires this behavior, so it is the default.
 
static string $defaultCharset = 'us-ascii'
 The default charset to use when parsing text parts with no charset information.
 
static string $defaultCharset = 'us-ascii'
 The default charset to use when parsing text parts with no charset information.
 
static $encodingTypes
 
string $id
 MIME ID.
 
static integer $memoryLimit = 2097152
 The memory limit for use with the PHP temp stream.
 
static $mimeTypes
 
while($this->_curr() !==false) return $out
 
Horde_Mime_Part $parent = null
 Parent object.
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see $value
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see $value
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see $value
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see $value
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see $value
 
$this _data = $data
 
$this _datalen = strlen($data)
 
$this _ptr = 0
 
foreach($this->_values as $val) $this _values = $copy
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see Countable
 
const DEFAULT_ENCODING = 'binary'
 
const ENCODE_7BIT = 1
 
const ENCODE_8BIT = 2
 
const ENCODE_BINARY = 4
 
const EOL = "\n"
 
*Any changes made directly to this file may will be lost in the future **Any unknown file extensions will automatically be mapped to *where< ext > is the unknown file extension ** Generated
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see Horde_Mime_Headers_Extension_Mime
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see http
 
***This file contains code adapted from PEAR s built in uudecode() method is broken. ** @author Chuck Hagenbuch< chuck @horde.org > * @author Aidan Lister< aidan @php.net > * @author Michael Slusarz< slusarz @horde.org > * @author Michael Wallner< mike @php.net > * @category Horde * @copyright 2009-2017 Horde LLC * @copyright 2004-2007 Aidan Lister< aidan @php.net > Arpad Ray< arpad @php.net > *license http
 
const ID_NEXT = 2
 
const ID_PREV = 3
 
const ID_UP = 4
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see Iterator
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see IteratorAggregate
 
***This file contains code adapted from PEAR s built in uudecode() method is broken. ** @author Chuck Hagenbuch< chuck @horde.org > * @author Aidan Lister< aidan @php.net > * @author Michael Slusarz< slusarz @horde.org > * @author Michael Wallner< mike @php.net > * @category Horde * @copyright 2009-2017 Horde LLC * @copyright 2004-2007 Aidan Lister< aidan @php.net > Arpad Ray< arpad @php.net > *license IteratorAggregate
 
const MIME_PARAM_QUOTED = '/[\x01-\x20\x22\x28\x29\x2c\x2f\x3a-\x40\x5b-\x5d]/'
 
const NESTING_LIMIT = 100
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see RecursiveIterator
 
const RFC_EOL = "\r\n"
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see Serializable
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see Serializable
 
*See the enclosed file LICENSE for license information(LGPL). If you *did not receive this file see Serializable
 
const STATUS_BASEPART = 2
 
const STATUS_REINDEX = 1
 
const UNKNOWN = 'x-unknown'
 
const UNKNOWN_ENCODING = 'x-unknown'
 Unknown encoding specifier.
 
const VALUE_BASE = 2
 
const VALUE_PARAMS = 3
 
const VALUE_STRING = 1
 

Detailed Description

Function Documentation

◆ __construct() [1/4]

__construct ( $name,
$value )

Constructor.

Parameters
string$nameHeader name.
mixed$valueHeader value(s).

◆ __construct() [2/4]

__construct ( $input = array())

Constructor.

Scans $input for uuencoded data and converts it to unencoded data.

Parameters
string$idMIME ID.
array$paramsA hash with basic message information. 'charset' is the character set of the message. 'body' is the message body. All other parameters are assumed to be message headers.
Exceptions
Horde_Mime_Exception
Parameters
array$dataV1 data.
string$inputThe input data

◆ __construct() [3/4]

__construct ( Horde_Mime_Headers $headers)

Constructor.

Parameters
Horde_Mime_Headers$mime_headersA headers object.

◆ __construct() [4/4]

__construct ( Horde_Mime_Part $mime_part)

Constructor.

Parameters
Horde_Mime_Part$mime_partA MIME part object. Must be of type multipart/related.

◆ __serialize()

__serialize ( )

Serialization.

Serialize (PHP 7.4+)

Return values
arraySerialized data.
arrayobject state

◆ __unserialize()

__unserialize ( array $data)

Unserialization.

Unserialize (PHP 7.4+)

Parameters
array$dataSerialized data.
Exceptions
Horde_Mime_Exception
Parameters
array$data

◆ _encode()

_encode ( $name,
$val,
$opts )
protected
See also
encode()

◆ _escapeParams()

_escapeParams ( $params)
protected

Escape the parameter array.

Parameters
array$paramsParameter array.
Return values
arrayEscaped parameter array.

◆ _findBoundary()

static _findBoundary ( $text,
$pos,
$boundary,
$end = null )
staticprotected

Find the location of the next boundary string.

Parameters
string$textThe text to search.
integer$posThe current position in $text.
string$boundaryThe boundary string.
integer$endIf set, return after matching this many boundaries.
Return values
arrayKeys are the boundary number, values are an array with two elements: 'start' and 'length'.

◆ _findHeader()

static _findHeader ( $text,
$eol )
staticprotected

Find the location of the end of the header text.

Parameters
string$textThe text to search.
string$eolThe EOL string.
Return values
integerHeader position.

◆ _getHeaderClassName()

_getHeaderClassName ( $header)
protected

Return the header class to use for a header name.

Parameters
string$headerThe header name.
Return values
stringThe Horde_Mime_Headers_* class to use.

◆ _getMimeExtensionMap()

static _getMimeExtensionMap ( )
staticprotected

Returns a copy of the MIME extension map.

Return values
arrayThe MIME extension map.

◆ _getStructure()

static _getStructure ( $header,
$body,
array $opts = array() )
staticprotected

Creates a MIME object from the text of one part of a MIME message.

Parameters
string$headerThe header text.
string$bodyThe body text.
array$optsAdditional options:
  - ctype: (string) The default content-type.
  - forcemime: (boolean) If true, the message data is assumed to be
               MIME data. If not, a MIME-Version header must exist to
               be parsed as a MIME message.
  - level: (integer) Current nesting level.
  - no_body: (boolean) If true, don't set body contents of parts.
Return values
Horde_Mime_PartThe MIME part object.

◆ _getTransferEncoding()

_getTransferEncoding ( $encode = self::ENCODE_7BIT)
protected

Get the transfer encoding for the part based on the user requested transfer encoding and the current contents of the part.

Parameters
integer$encodeA mask of allowable encodings.
Return values
stringThe transfer-encoding of this part.

◆ _idArithmetic()

_idArithmetic ( $id,
$action,
$options )
protected
See also
idArithmetic()

◆ _readStream()

_readStream ( $fp,
$close = false )
protected

Read data from a stream.

Parameters
resource$fpAn active stream.
boolean$closeClose the stream when done reading?
Return values
stringThe data from the stream.

◆ _reEncodeMessageAttachment()

_reEncodeMessageAttachment ( Horde_Mime_Part $part)
protected

Rebuilds $part and forces it to be a base64 encoded application/octet-stream part.

Parameters
Horde_Mime_Part$partThe MIME part.

◆ _reindex()

_reindex ( $force = false)
protected

Reindexes the MIME IDs, if necessary.

Parameters
boolean$forceReindex if the current part doesn't have an ID.

◆ _sanityCheck()

_sanityCheck ( $data)
protected

Perform sanity checking on a header value.

Parameters
string$dataThe header data.
Return values
stringThe cleaned header data.

◆ _sanityCheckRfc822Attachments()

_sanityCheckRfc822Attachments ( )
protected

Re-enocdes message/rfc822 parts in case there was e.g., some broken line length in the headers of the message in the part.

Since we shouldn't alter the original message in any way, we simply reset cause the part to be encoded as base64 and sent as a application/octet part.

◆ _scanStream()

_scanStream ( $fp)
protected

Scans a stream for content type.

Parameters
resource$fpA stream resource.
Return values
mixedEither 'binary', '8bit', or false.

◆ _sendEncode()

_sendEncode ( $opts)
protected

TODO.

Parameters
array$optsSee doSendEncode().
array$optsSee Horde_Mime_Headers_Addresses\doSendEncode().
array$optsSee encode().

◆ _setValue()

_setValue ( $data)
abstractprotected

TODO.

Exceptions
Horde_Mime_Exception
Parameters
mixed$valueEither a single language or an array of languages.
mixed$dataEither an array (interpreted as a list of parameters), a string (interpreted as a RFC encoded parameter list), an object with two properties: value and params, or a Horde_Mime_Headers_ContentParam object.

◆ _transferDecode()

_transferDecode ( $fp,
$encoding )
protected

Decodes the contents of the part to binary encoding.

Parameters
resource$fpA stream containing the data to decode.
string$encodingThe original file encoding.
Return values
resourceA new file resource with the decoded data.

◆ _transferEncode()

_transferEncode ( $fp,
$encoding )
protected

Encodes the contents of the part as necessary for transport.

Parameters
resource$fpA stream containing the data to encode.
string$encodingThe encoding to use.
Return values
resourceA new file resource with the encoded data.

◆ _uudecode()

_uudecode ( $input)
protected

PHP 5's built-in convert_uudecode() is broken.

Need this wrapper.

Parameters
string$inputUUencoded input.
Return values
stringDecoded string.

◆ _writeStream()

_writeStream ( $data,
$options = array() )
protected

Write data to a stream.

Parameters
array$dataThe data to write. Either a stream resource or a string.
array$optionsAdditional options:
  • error: (boolean) Catch errors when writing to the stream. Throw an ErrorException if an error is found. DEFAULT: false
  • filter: (array) Filter(s) to apply to the string. Keys are the filter names, values are filter params.
  • fp: (resource) Use this stream instead of creating a new one.
Return values
resourceThe stream resource.
Exceptions
ErrorException

◆ addAttachment()

addAttachment ( $file,
$name = null,
$type = null,
$charset = 'us-ascii' )

Adds an attachment.

Parameters
string$fileThe path to the file.
string$nameThe file name to use for the attachment.
string$typeThe content type of the file.
string$charsetThe character set of the part (only relevant for text parts.
Return values
integerThe part number.

◆ addHeader() [1/2]

addHeader ( $header,
$value,
$overwrite = null )

Adds a message header.

Parameters
string$headerThe header name.
string$valueThe header value.
boolean$overwriteIf true, an existing header of the same name is being overwritten; if false, multiple headers are added; if null, the correct behaviour is automatically chosen depending on the header name.
Exceptions
Horde_Mime_Exception

◆ addHeader() [2/2]

addHeader ( $header,
$value,
array $opts = array() )

Add/append/replace a header.

Parameters
string$headerThe header name.
string$valueThe header value (UTF-8).
array$optsDEPRECATED

◆ addHeaderOb() [1/2]

addHeaderOb ( Horde_Mime_Headers_Element $ob)

Add a Horde_Mime_Headers_Element object to the current header list.

Since
2.5.0
Parameters
Horde_Mime_Headers_Element$obHeader object to add.
Exceptions
InvalidArgumentException

◆ addHeaderOb() [2/2]

addHeaderOb ( Horde_Mime_Headers_Element $ob,
$check = false )

Add a Horde_Mime_Headers_Element object to the current header list.

Since
2.5.0
Parameters
Horde_Mime_Headers_Element$obHeader object to add.
boolean$checkCheck that the header and object type match?
Exceptions
InvalidArgumentException

◆ addHeaders()

addHeaders ( $headers = array())

Adds several message headers at once.

Parameters
array$headerHash with header names as keys and header contents as values.
Exceptions
Horde_Mime_Exception

◆ addMdnRequestHeaders()

addMdnRequestHeaders ( $to)

Add a MDN (read receipt) request header.

Parameters
mixed$toThe address(es) the receipt should be mailed to.

◆ addMimeHeaders()

addMimeHeaders ( $options = array())

Returns a Horde_Mime_Header object containing all MIME headers needed for the part.

Parameters
array$optionsAdditional options:
  • encode: (integer) A mask of allowable encodings. DEFAULT: Auto-determined
  • headers: (Horde_Mime_Headers) The object to add the MIME headers to. DEFAULT: Add headers to a new object
Return values
Horde_Mime_HeadersA Horde_Mime_Headers object.

◆ addMimePart()

addMimePart ( $part)

Adds a MIME message part.

Parameters
Horde_Mime_Part$partA Horde_Mime_Part object.
Return values
integerThe part number.

◆ addPart() [1/2]

addPart ( $mime_part)
Deprecated
Use array access instead.

◆ addPart() [2/2]

addPart ( $mime_type,
$content,
$charset = 'us-ascii',
$disposition = null )

Adds a message part.

Parameters
string$mime_typeThe content type of the part.
string$contentThe content of the part.
string$charsetThe character set of the part.
string$dispositionThe content disposition of the part.
Return values
integerThe part number.

◆ addRecipients()

addRecipients ( $recipients)

Adds message recipients.

Recipients specified by To:, Cc:, or Bcc: headers are added automatically.

Parameters
string|arrayList of recipients, either as a comma separated list or as an array of email addresses.
Exceptions
Horde_Mime_Exception

◆ alterPart()

alterPart ( $id,
$mime_part )
Deprecated
Use array access instead.

◆ analyzeData()

static analyzeData ( $data,
$magic_db = null,
$opts = array() )
static

Attempt to determine the MIME type of an unknown byte stream.

Parameters
string$dataThe file data to analyze.
string$magic_dbPath to the mime magic database.
array$optsAdditional options:
  • nostrip: (boolean) Don't strip parameter information from MIME type string. DEFAULT: false
Return values
mixedThe MIME type of the file. Returns false if the file type can not be determined.

◆ analyzeFile()

static analyzeFile ( $path,
$magic_db = null,
$opts = array() )
static

Attempt to determine the MIME type of an unknown file.

Parameters
string$pathThe path to the file to analyze.
string$magic_dbPath to the mime magic database.
array$optsAdditional options:
  • nostrip: (boolean) Don't strip parameter information from MIME type string. DEFAULT: false
Return values
mixedThe MIME type of the file. Returns false if the file type can not be determined.

◆ appendContents()

appendContents ( $contents,
$options = array() )

Add to the body contents of this part.

Parameters
mixed$contentsThe part body. Either a string or a stream resource, or an array containing both.
  • encoding: (string) The encoding of $contents. DEFAULT: Current transfer encoding value.
  • usestream: (boolean) If $contents is a stream, should we directly use that stream? DEFAULT: $contents copied to a new stream.

◆ buildMimeIds()

buildMimeIds ( $id = null,
$rfc822 = false )

Build the MIME IDs for this part and all subparts.

Parameters
string$idThe ID of this part.
boolean$rfc822Is this a message/rfc822 part?

◆ cidReplace()

cidReplace ( $text,
$callback,
$charset = 'UTF-8' )

Scan for CID strings in HTML data and replace with data returned from a callback method.

Parameters
mixed$textThe HTML text (can be Horde_Domhtml object).
callback$callbackCallback method. Receives three arguments: MIME ID, the attribute name containing the content ID, and the node object. Expects return value of URL to display the data.
string$charsetHTML data charset.
Return values
Horde_DomhtmlA Horde_Domhtml object.

◆ cidSearch()

cidSearch ( $cid)

Search for a CID in the related part.

Parameters
string$cidThe CID to search for.
Return values
stringThe MIME ID or false if not found.

◆ clearContentTypeParameter()

clearContentTypeParameter ( $label)
Deprecated
Use setContentTypeParameter with a null $data value.

◆ contentTypeMap()

contentTypeMap ( $sort = true)
Deprecated
Use iterator instead.

◆ count()

count ( )

Returns the number of child message parts (doesn't include grandchildren or more remote ancestors).

Returns the number of message parts.

Return values
integerNumber of message parts.

◆ create()

static create ( )
static

Creates a default Content-Type header, conforming to the MIME specification as detailed in RFC 2045.

Return values
Horde_Mime_Headers_ContentParam_ContentTypeContent-Type header object.

◆ current()

current ( )
Since
2.8.0

◆ decode()

decode ( $data)
static

Decodes a MIME encoded (RFC 2047) string.

Decodes a MIME content parameter string pursuant to RFC 2183 & 2231 (Content-Type and Content-Disposition headers).

Parameters
string$stringThe MIME encoded text.
Return values
stringThe decoded text.

Stores value/parameter data in the current object.

Parameters
mixed$dataParameter data. Either an array or a string.

◆ decodeParam()

static decodeParam ( $type,
$data )
static
Deprecated
Use Horde_Mime_Headers_ELement_ContentParam instead.

◆ doSendEncode()

static doSendEncode ( $alist,
array $opts = array() )
static

Do send encoding for addresses.

Needed as a static function because it is used by both single and multiple address headers.

Todo
Implement with traits.
Parameters
array$alistAn array of Horde_Mail_Rfc822_List objects.
array$optsAdditional options:
  • charset: (string) Encodes the headers using this charset. DEFAULT: UTF-8
  • defserver: (string) The default domain to append to mailboxes. DEFAULT: No default name.
  • idn: (boolean) Encode IDN domain names (RFC 3490) if true. DEFAULT: true

◆ encode() [1/3]

static encode ( $text,
$charset = 'UTF-8' )
static

MIME encodes a string (RFC 2047).

Parameters
string$textThe text to encode (UTF-8).
string$charsetThe character set to encode to.
Return values
stringThe MIME encoded string (US-ASCII).

◆ encode() [2/3]

static encode ( $text,
$eol = "\n",
$wrap = 76 )
static

Encodes text via quoted-printable encoding.

Parameters
string$textThe text to encode (UTF-8).
string$eolThe EOL sequence to use.
integer$wrapWrap a line at this many characters.
Return values
stringThe quoted-printable encoded string.

◆ encode() [3/3]

encode ( array $opts = array())

Encodes a MIME content parameter string pursuant to RFC 2183 & 2231 (Content-Type and Content-Disposition headers).

Parameters
array$optsOptions:
  • broken_rfc2231: (boolean) Attempt to work around non-RFC 2231-compliant MUAs by generating both a RFC 2047-like parameter name and also the correct RFC 2231 parameter DEFAULT: false
  • charset: (string) The charset to encode to. DEFAULT: UTF-8
  • lang: (string) The language to use when encoding. DEFAULT: None specified
Return values
arrayThe encoded parameter string (US-ASCII).

◆ encodeParam()

static encodeParam ( $name,
$val,
array $opts = array() )
static
Deprecated
Use Horde_Mime_Headers_ContentParam\encode() instead.

◆ extToMime()

static extToMime ( $ext)
static

Attempt to convert a file extension to a MIME type, based on the global Horde and application specific config files.

If we cannot map the file extension to a specific type, then we fall back to a custom MIME handler 'x-extension/$ext', which can be used as a normal MIME type internally throughout Horde.

Parameters
string$extThe file extension to be mapped to a MIME type.
Return values
stringThe MIME type of the file extension.

◆ filenameToMime()

static filenameToMime ( $filename,
$unknown = true )
static

Attempt to convert a filename to a MIME type, based on the global Horde and application specific config files.

Parameters
string$filenameThe filename to be mapped to a MIME type.
boolean$unknownHow should unknown extensions be handled? If true, will return 'x-extension/*' types. If false, will return 'application/octet-stream'.
Return values
stringThe MIME type of the filename.

◆ filter()

filter ( $in,
$out,
& $consumed,
$closing )
See also
stream_filter_register()

◆ findBody()

findBody ( $subtype = null)

Finds the main "body" text part (if any) in a message.

"Body" data is the first text part under this part.

Parameters
string$subtypeSpecifically search for this subtype.
Return values
mixedThe MIME ID of the main body part, or null if a body part is not found.

◆ generate()

generate ( $action,
$sending,
$type,
$name,
$mailer,
array $opts = array(),
array $mod = array(),
array $err = array() )

Generate the MDN according to the specifications listed in RFC 3798 [3].

Parameters
boolean$actionWas this MDN type a result of a manual action on part of the user?
boolean$sendingWas this MDN sent as a result of a manual action on part of the user?
string$typeThe type of action performed by the user. Per RFC 3798 [3.2.6.2] the following types are valid:
  • deleted
  • displayed
string$nameThe name of the local server.
Horde_Mail_Transport$mailerMail transport object.
array$optsAdditional options:
  • charset: (string) Default charset. DEFAULT: NONE
  • from_addr: (string) From address. DEFAULT: NONE
array$modThe list of modifications. Per RFC 3798 [3.2.6.3] the following modifications are valid:
  • error
array$errIf $mod is 'error', the additional information to provide. Key is the type of modification, value is the text.

◆ generateMessageId()

static generateMessageId ( )
static
Deprecated
Use Horde_Mime_Headers_MessageId\create() instead.

◆ getAllContentTypeParameters()

getAllContentTypeParameters ( )

Get all parameters from the Content-Type header.

Return values
arrayAn array of all the parameters Returns the empty array if no parameters set.

◆ getAllDispositionParameters()

getAllDispositionParameters ( )

Get all parameters from the Content-Disposition header.

Return values
arrayAn array of all the parameters Returns the empty array if no parameters set.

◆ getBasePart()

getBasePart ( )

Return the base MIME part.

Return values
Horde_Mime_Part

◆ getBytes()

getBytes ( $approx = false)

Determine the size of this MIME part and its child members.

Todo
Remove $approx parameter.
Parameters
boolean$approxIf true, determines an approximate size for parts consisting of base64 encoded data.
Return values
integerSize of the part, in bytes.

◆ getCharset()

getCharset ( )

Get the character set to use for this part.

Return values
stringThe character set of this part (lowercase). Returns null if there is no character set.

◆ getChildren()

getChildren ( )
Since
2.8.0

◆ getContentId()

getContentId ( )

Returns the Content-ID for this part.

Return values
stringThe Content-ID for this part (null if not set).

◆ getContents()

getContents ( $options = array())

Return the body of the part.

Parameters
array$optionsAdditional options:
  • canonical: (boolean) Returns the contents in strict RFC 822 & 2045 output - namely, all newlines end with the canonical <CR><LF> sequence. DEFAULT: No
  • stream: (boolean) Return the body as a stream resource. DEFAULT: No
Return values
mixedThe body text (string) of the part, null if there is no contents, and a stream resource if 'stream' is true.

◆ getContentTypeParameter()

getContentTypeParameter ( $label)

Get a content type parameter from this part.

Parameters
string$labelThe content type parameter label.
Return values
stringThe data requested. Returns null if $label is not set.

◆ getDefaultType()

getDefaultType ( )

If the subtype of a MIME part is unrecognized by an application, the default type should be used instead (See RFC 2046).

This method returns the default subtype for a particular primary MIME type.

Return values
stringThe default MIME type of this part (ex.: text/plain).

◆ getDescription()

getDescription ( $default = false)

Get the description of this part.

Parameters
boolean$defaultIf the description parameter doesn't exist, should we use the name of the part?
Return values
stringThe description of this part.

◆ getDisposition()

getDisposition ( )

Get the content-disposition of this part.

Return values
stringThe part's content-disposition. An empty string means no desired disposition has been set for this part.

◆ getDispositionParameter()

getDispositionParameter ( $label)

Get a disposition parameter from this part.

Parameters
string$labelThe disposition parameter label.
Return values
stringThe data requested. Returns null if $label is not set.

◆ getDuration()

getDuration ( )

Get the content duration of the data contained in this part (see RFC 3803).

Return values
integerThe duration of the data, in seconds. Returns null if there is no duration information.

◆ getEOL()

getEOL ( )

Get the string to use for EOLs.

Deprecated
Return values
stringThe string to use for EOLs.

◆ getHeader()

getHeader ( $header)

Get a header from the header array.

Parameters
string$headerThe header name.
Return values
Horde_Mime_Headers_ElementElement object, or null if not found.

◆ getHeaderCharset()

getHeaderCharset ( )

Get the character set to use when outputting MIME headers.

Return values
stringThe character set. If no preferred character set has been set, returns null.

◆ getIterator()

getIterator ( )
Since
2.5.0

◆ getLanguage()

getLanguage ( )

Get the language(s) of this part.

Parameters
arrayThe list of languages.

◆ getMdnReturnAddr()

getMdnReturnAddr ( )

Returns the address(es) to return the MDN to.

Return values
stringThe address(es) to send the MDN to. Returns null if no MDN is requested.

◆ getMetadata()

getMetadata ( $key)

Retrieves metadata from this object.

Parameters
string$keyThe metadata key.
Return values
mixedThe metadata, or null if it doesn't exist.

◆ getMimeId()

getMimeId ( )

Returns the MIME ID of this part.

Return values
stringThe MIME ID.

◆ getName()

getName ( $default = false)

Get the name of this part.

Parameters
boolean$defaultIf the name parameter doesn't exist, should we use the default name from the description parameter?
Return values
stringThe name of the part.

◆ getPart()

getPart ( $id)
Deprecated
Use array access instead.

◆ getPartByIndex()

getPartByIndex ( $index)

Returns a subpart by index.

Return values
Horde_Mime_PartPart, or null if not found.

◆ getParts()

getParts ( )

Get a list of all MIME subparts.

Return values
arrayAn array of the Horde_Mime_Part subparts.

◆ getPrimaryType()

getPrimaryType ( )

Get the primary type of this part.

Return values
stringThe primary MIME type of this part.

◆ getRaw()

getRaw ( $stream = true)

Get the raw email data sent by this object.

Parameters
boolean$streamIf true, return a stream resource, otherwise a string is returned.
Return values
resource|stringThe raw email data.
Since
2.4.0

◆ getRawPartText()

static getRawPartText ( $text,
$type,
$id )
static

Attempts to obtain the raw text of a MIME part.

Parameters
mixed$textThe full text of the MIME message. The text is assumed to be MIME data (no MIME-Version checking is performed). It can be either a stream or a string.
string$typeEither 'header' or 'body'.
string$idThe MIME ID.
Return values
stringThe raw text.
Exceptions
Horde_Mime_Exception

◆ getSize()

getSize ( $approx = false)

Output the size of this MIME part in KB.

Todo
Remove $approx parameter.
Parameters
boolean$approxIf true, determines an approximate size for parts consisting of base64 encoded data.
Return values
stringSize of the part in KB.

◆ getSubType()

getSubType ( )

Get the subtype of this part.

Return values
stringThe MIME subtype of this part.

◆ getType()

getType ( $charset = false)

Get the full MIME Content-Type of this part.

Parameters
boolean$charsetAppend character set information to the end of the content type if this is a text/* part? `
Return values
stringThe MIME type of this part.

◆ hasChildren()

hasChildren ( )
Since
2.8.0

◆ idArithmetic()

idArithmetic ( $action,
array $options = array() )

Performs MIME ID "arithmetic".

Parameters
string$actionOne of:
  • ID_DOWN: ID of child. Note: ID_DOWN will first traverse to "$id.0" if given an ID NOT of the form "$id.0". If given an ID of the form "$id.0", ID_DOWN will traverse to "$id.1". This behavior can be avoided if 'no_rfc822' option is set.
  • ID_NEXT: ID of next sibling.
  • ID_PREV: ID of previous sibling.
  • ID_UP: ID of parent. Note: ID_UP will first traverse to "$id.0" if given an ID NOT of the form "$id.0". If given an ID of the form "$id.0", ID_UP will traverse to "$id". This behavior can be avoided if 'no_rfc822' option is set.
array$optionsAdditional options:
  • count: (integer) How many levels to traverse. DEFAULT: 1
  • no_rfc822: (boolean) Don't traverse RFC 822 sub-levels. DEFAULT: false
Return values
mixedThe resulting ID string, or null if that ID can not exist.

◆ is8bit()

static is8bit ( $string,
$charset = null )
static

Determines if a string contains 8-bit (non US-ASCII) characters.

Parameters
string$stringThe string to check.
string$charsetThe charset of the string. Defaults to US-ASCII. (
Deprecated
)
Return values
booleanTrue if string contains non 7-bit characters.

◆ isAtextNonTspecial()

static isAtextNonTspecial ( $c)
static

Determine if character is a non-escaped element in MIME parameter data (See RFC 2045 [Appendix A]).

Parameters
string$cCharacter to test.
Return values
booleanTrue if non-escaped character.

◆ isAttachment()

isAttachment ( )

Determines if this MIME part is an attachment for display purposes.

Since
Horde_Mime 2.10.0
Return values
booleanTrue if this part should be considered an attachment.

◆ isBasePart()

isBasePart ( $base)

Is this the base MIME part?

Parameters
boolean$baseTrue if this is the base MIME part.

◆ isChild() [1/2]

static isChild ( $base,
$id )
static
Deprecated
Use Horde_Mime_Id instead.

◆ isChild() [2/2]

isChild ( $id)

Determines if a given MIME ID lives underneath a base ID.

Parameters
string$idThe MIME ID to query.
Return values
booleanWhether $id lives under the base ID ($this->id).

◆ isDefault()

isDefault ( )

If true, indicates the contents of the header is the default value.

Since
2.8.0
Return values
booleanTrue if this header is the default value.

◆ key()

key ( )
Since
2.8.0

◆ mimeIdArithmetic()

static mimeIdArithmetic ( $id,
$action,
$options = array() )
static
Deprecated
Use Horde_Mime_Id instead.

◆ mimeToExt()

static mimeToExt ( $type)
static

Attempt to convert a MIME type to a file extension, based on the global Horde and application specific config files.

If we cannot map the type to a file extension, we return false.

Parameters
string$typeThe MIME type to be mapped to a file extension.
Return values
stringThe file extension of the MIME type.

◆ next()

next ( )
Since
2.8.0

◆ offsetExists()

offsetExists ( $offset)

Does header exist?

Since
2.5.0
Parameters
string$headerHeader name.
Return values
booleanTrue if header exists.

◆ offsetGet()

offsetGet ( $offset)

Return header element object.

Since
2.5.0
Parameters
string$headerHeader name.
Return values
Horde_Mime_Headers_ElementElement object, or null if not found.

◆ offsetSet()

offsetSet ( $offset,
$value )

Store a header element object.

Since
2.5.0
Parameters
string$offsetNot used.
Horde_Mime_Headers_Element$eltHeader element.

◆ offsetUnset()

offsetUnset ( $offset)

Remove a header element object.

Since
2.5.0
Parameters
string$offsetHeader name.

◆ onCreate()

onCreate ( )
See also
stream_filter_register()

◆ originalMessageText()

originalMessageText ( $text)

When generating the MDN, should we return the enitre text of the original message? The default is no - we only return the headers of the original message.

If the text is passed in via this method, we will return the entire message.

Parameters
string$textThe text of the original message.

◆ parseHeaders()

static parseHeaders ( $text)
static

Builds a Horde_Mime_Headers object from header text.

Parameters
mixed$textA text string (or, as of 2.3.0, a Horde_Stream object or stream resource) containing the headers.
Return values
Horde_Mime_HeadersA new Horde_Mime_Headers object.

◆ parseMessage()

static parseMessage ( $text,
array $opts = array() )
static

Attempts to build a Horde_Mime_Part object from message text.

Parameters
string$textThe text of the MIME message.
array$optsAdditional options:
  • forcemime: (boolean) If true, the message data is assumed to be MIME data. If not, a MIME-Version header must exist (RFC 2045 [4]) to be parsed as a MIME message. DEFAULT: false
  • level: (integer) Current nesting level of the MIME data. DEFAULT: 0
  • no_body: (boolean) If true, don't set body contents of parts (since 2.2.0). DEFAULT: false
Return values
Horde_Mime_PartA MIME Part object.
Exceptions
Horde_Mime_Exception

◆ partIterator()

partIterator ( $current = true)

Returns the recursive iterator needed to iterate through this part.

Since
2.8.0
Parameters
boolean$currentInclude the current part as the base?
Return values
IteratorRecursive iterator.

◆ quotedPrintableEncode()

static quotedPrintableEncode ( $text,
$eol = self::EOL,
$wrap = 76 )
static
Deprecated
Use Horde_Mime_QuotedPrintable instead.

◆ removeHeader()

removeHeader ( $header)

Remove a header from the header array.

Removes a message header.

Parameters
string$headerThe header name.

◆ removePart()

removePart ( $id)

Removes a message part.

Parameters
integer$partThe part number.
Deprecated
Use array access instead.

◆ removeRecipients()

removeRecipients ( $recipients)

Removes message recipients.

Parameters
string|arrayList of recipients, either as a comma separated list or as an array of email addresses.
Exceptions
Horde_Mime_Exception

◆ replaceEOL()

replaceEOL ( $text,
$eol = null,
$stream = false )

Replace newlines in this part's contents with those specified by either the given newline sequence or the part's current EOL setting.

Parameters
mixed$textThe text to replace. Either a string or a stream resource. If a stream, and returning a string, will close the stream when done.
string$eolThe EOL sequence to use. If not present, uses the part's current EOL setting.
boolean$streamIf true, returns a stream resource.
Return values
stringThe text with the newlines replaced by the desired newline sequence (returned as a stream resource if $stream is true).

◆ rewind()

rewind ( )
Since
2.8.0

◆ send() [1/2]

send ( $email,
$headers,
Horde_Mail_Transport $mailer,
array $opts = array() )

Sends this message.

Parameters
string$emailThe address list to send to.
Horde_Mime_Headers$headersThe Horde_Mime_Headers object holding this message's headers.
Horde_Mail_Transport$mailerA Horde_Mail_Transport object.
array$optsAdditional options:
  - broken_rfc2231: (boolean) Attempt to work around non-RFC
                    2231-compliant MUAs by generating both a RFC
                    2047-like parameter name and also the correct RFC
                    2231 parameter (
Since
 2.5.0).
                    DEFAULT: false
  - encode: (integer) The encoding to use. A mask of self\ENCODE_*
            values.
            DEFAULT: Auto-determined based on transport driver.
Exceptions
Horde_Mime_Exception
InvalidArgumentException

◆ send() [2/2]

send ( $mailer,
$resend = false,
$flowed = true )

Sends this message.

Parameters
Horde_Mail_Transport$mailerA Horde_Mail_Transport object.
boolean$resendIf true, the message id and date are re-used; If false, they will be updated.
boolean$flowedSend message in flowed text format.
Exceptions
Horde_Mime_Exception

◆ sendEncode()

sendEncode ( array $opts = array())
final

Returns the encoded string value(s) needed when sending the header text to a RFC compliant mail submission server.

Parameters
array$optsAdditional options:
  • charset: (string) Charset to encode to. DEFAULT: UTF-8
Return values
arrayAn array of string values.

◆ serialize()

serialize ( )

Serialization.

Serialize (until PHP 7.3)

Return values
stringSerialized data.
stringserialized object state

◆ setBasePart()

setBasePart ( $part)

Sets the base MIME part.

If the base part is set, any text bodies will be ignored when building the message.

Parameters
Horde_Mime_Part$partA Horde_Mime_Part object.

◆ setBody()

setBody ( $body,
$charset = null,
$wrap = false )

Sets the message body text.

Parameters
string$bodyThe message content.
string$charsetThe character set of the message.
boolean | integer$wrapIf true, wrap the message at column 76; If an integer wrap the message at that column. Don't use wrapping if sending flowed messages.

◆ setBytes()

setBytes ( $bytes)

Explicitly set the size (in bytes) of this part.

This value will only be returned (via getBytes()) if there are no contents currently set.

This function is useful for setting the size of the part when the contents of the part are not fully loaded (i.e. creating a Horde_Mime_Part object from IMAP header information without loading the data of the part).

Parameters
integer$bytesThe size of this part in bytes.

◆ setCharset()

setCharset ( $charset)

Set the character set of this part.

Parameters
string$charsetThe character set of this part.

◆ setContentId()

setContentId ( $cid = null)

Sets the Content-ID header for this part.

Parameters
string$cidUse this CID (if not already set). Else, generate a random CID.
Return values
stringThe Content-ID for this part.

◆ setContentParamValue()

setContentParamValue ( $data)

Set the content-parameter base value.

Since
2.8.0
Parameters
string$dataValue.

◆ setContents()

setContents ( $contents,
$options = array() )

Set the body contents of this part.

Parameters
mixed$contentsThe part body. Either a string or a stream resource, or an array containing both.
array$optionsAdditional options:
  • encoding: (string) The encoding of $contents. DEFAULT: Current transfer encoding value.
  • usestream: (boolean) If $contents is a stream, should we directly use that stream? DEFAULT: $contents copied to a new stream.

◆ setContentTypeParameter()

setContentTypeParameter ( $label,
$data )

Add/remove a content type parameter to this part.

Parameters
string$labelThe content-type parameter label.
string$dataThe content-type parameter data. If null, removes the parameter (
Since
2.8.0).

◆ setDescription()

setDescription ( $description)

Set the description of this part.

Parameters
string$descriptionThe description of this part. If null, deletes the description (
Since
2.8.0).

◆ setDisposition()

setDisposition ( $disposition = null)

Set the content-disposition of this part.

Parameters
string$dispositionThe content-disposition to set ('inline', 'attachment', or an empty value).

◆ setDispositionParameter()

setDispositionParameter ( $label,
$data )

Add a disposition parameter to this part.

Parameters
string$labelThe disposition parameter label.
string$dataThe disposition parameter data. If null, removes the parameter (
Since
2.8.0).

◆ setDuration()

setDuration ( $duration)

Set the content duration of the data contained in this part (see RFC 3803).

Parameters
integer$durationThe duration of the data, in seconds. If null, clears the duration information.

◆ setEOL()

setEOL ( $eol)

Sets a new string to use for EOLs.

Deprecated
Parameters
string$eolThe string to use for EOLs.

◆ setHeaderCharset()

setHeaderCharset ( $charset)

Set the character set to use when outputting MIME headers.

Parameters
string$charsetThe character set.

◆ setHtmlBody()

setHtmlBody ( $body,
$charset = null,
$alternative = true )

Sets the HTML message body text.

Parameters
string$bodyThe message content.
string$charsetThe character set of the message.
boolean$alternativeIf true, a multipart/alternative message is created and the text/plain part is generated automatically. If false, a text/html message is generated.

◆ setLanguage()

setLanguage ( $lang)

Set the language(s) of this part.

Parameters
mixed$langA language string, or an array of language strings.

◆ setMetadata()

setMetadata ( $key,
$data = null )

Set a piece of metadata on this object.

Parameters
string$keyThe metadata key.
mixed$dataThe metadata. If null, clears the key.

◆ setMimeId()

setMimeId ( $mimeid)

Alter the MIME ID of this part.

Parameters
string$mimeidThe MIME ID.

◆ setName()

setName ( $name)

Set the name of this part.

Parameters
string$nameThe name to set.

◆ setTransferEncoding()

setTransferEncoding ( $encoding,
$options = array() )

Set the transfer encoding to use for this part.

Only needed in the following circumstances: 1.) Indicate what the transfer encoding is if the data has not yet been set in the object (can only be set if there presently are not any contents). 2.) Force the encoding to a certain type on a toString() call (if 'send' is true).

Parameters
string$encodingThe transfer encoding to use.
array$optionsAdditional options:
  • send: (boolean) If true, use $encoding as the sending encoding. DEFAULT: $encoding is used to change the base encoding.

◆ setType()

setType ( $type)

Set the MIME type of this part.

Parameters
string$typeThe MIME type to set (ex.: text/plain).

◆ setValue()

setValue ( $value)
final

Set the value of the header.

Parameters
mixed$valueHeader value(s).

◆ startId()

startId ( )

Return the start ID.

Return values
stringThe start ID.

◆ toArray()

toArray ( array $opts = array())

Returns the headers in array format.

Parameters
array$optsOptional parameters:
  - broken_rfc2231: (boolean) Attempt to work around non-RFC
                    2231-compliant MUAs by generating both a RFC
                    2047-like parameter name and also the correct RFC
                    2231 parameter
                    DEFAULT: false
  - canonical: (boolean) Use canonical (RFC 822/2045) CRLF EOLs?
               DEFAULT: Uses "::n"
  - charset: (string) Encodes the headers using this charset. If empty,
             encodes using UTF-8.
             DEFAULT: No encoding.
  - defserver: (string) The default domain to append to mailboxes.
               DEFAULT: No default name.
  - lang: (string) The language to use when encoding.
          DEFAULT: None specified
  - nowrap: (integer) Don't wrap the headers.
            DEFAULT: Headers are wrapped.
Return values
arrayThe headers in array format. Keys are header names, but case sensitivity cannot be guaranteed. Values are header values.

◆ toString() [1/2]

toString ( $options = array())

Return the entire part in MIME format.

Parameters
array$optionsAdditional options:
  • canonical: (boolean) Returns the encoded part in strict RFC 822 & 2045 output - namely, all newlines end with the canonical <CR><LF> sequence. DEFAULT: false
  • defserver: (string) The default server to use when creating the header string. DEFAULT: none
  • encode: (integer) A mask of allowable encodings. DEFAULT: self\ENCODE_7BIT
  • headers: (mixed) Include the MIME headers? If true, create a new headers object. If a Horde_Mime_Headers object, add MIME headers to this object. If a string, use the string verbatim. DEFAULT: true
  • id: (string) Return only this MIME ID part. DEFAULT: Returns the base part.
  • stream: (boolean) Return a stream resource. DEFAULT: false
Return values
mixedThe MIME string (returned as a resource if $stream is true).

◆ toString() [2/2]

toString ( array $opts = array())

Returns all headers concatenated into a single string.

Parameters
array$optsSee toArray().
Return values
stringThe headers in string format.

◆ unserialize()

unserialize ( $data)

Unserialization.

Unserialize (until PHP 7.3)

Parameters
string$dataSerialized data.
Exceptions
Exception
Parameters
string$data

◆ userConfirmationNeeded()

userConfirmationNeeded ( )

Is user input required to send the MDN? Explicit confirmation is needed in some cases to prevent mail loops and the use of MDNs for mail bombing.

Return values
booleanIs explicit user input required to send the MDN?

◆ uudecode()

static uudecode ( $input)
static
Deprecated
Use Horde_Mime_Uudecode instead.

◆ valid()

valid ( )
Since
2.8.0

Variable Documentation

◆ $_contents

resource $_contents
protected

The body of the part.

Always stored in binary format.

◆ $_data

array $_data = array()
protected

Uudecode data.

A list of arrays, with each array corresponding to a file in the input and containing the following keys:

  • data: (string) Unencoded data.
  • name: (string) Filename.
  • perms: (string) Octal permissions.

◆ $_eol [1/2]

$_eol = "\n"
protected

◆ $_eol [2/2]

string $_eol = self::EOL
protected

The sequence to use as EOL for this part.

The default is currently to output the EOL sequence internally as just "::n" instead of the canonical "\r\n" required in RFC 822 & 2045. To be RFC complaint, the full <CR><LF> EOL combination should be used when sending a message.

◆ $_mailer_driver

string $_mailer_driver = 'smtp'
protected

The Mail driver name.

@externalurl http://pear.php.net/Mail

◆ $_mailer_params

array $_mailer_params = array()
protected

The Mail driver parameters.

@externalurl http://pear.php.net/Mail

◆ $brokenRFC2231

$brokenRFC2231 = false
static

◆ $defaultCharset [1/2]

string $defaultCharset = 'us-ascii'
static

The default charset to use when parsing text parts with no charset information.

Todo
Make this a non-static property or pass as parameter to static methods in Horde 6.

◆ $defaultCharset [2/2]

string $defaultCharset = 'us-ascii'
static

The default charset to use when parsing text parts with no charset information.

Todo
Make this a non-static property or pass as parameter to static methods in Horde 6.

◆ $encodingTypes

$encodingTypes
static
Initial value:
= array(
'7bit', '8bit', 'base64', 'binary', 'quoted-printable',
'uuencode', 'x-uuencode', 'x-uue'
)
Deprecated

◆ $mimeTypes

$mimeTypes
static
Initial value:
= array(
'text', 'multipart', 'message', 'application', 'audio', 'image',
'video', 'model'
)
Deprecated

◆ $parent

Horde_Mime_Part $parent = null

Parent object.

Value only accurate when iterating.

Since
2.8.0

◆ $value [1/5]

*See the enclosed file LICENSE for license information (LGPL). If you *did not receive this file see $value
Initial value:
{
parent::__construct('Content-Description', $value)

◆ $value [2/5]

*See the enclosed file LICENSE for license information (LGPL). If you *did not receive this file see $value
Initial value:
{
parent::__construct('Content-Language', $value)

◆ $value [3/5]

*See the enclosed file LICENSE for license information (LGPL). If you *did not receive this file see $value
Initial value:
{
parent::__construct('Content-Disposition', $value)

◆ $value [4/5]

*See the enclosed file LICENSE for license information (LGPL). If you *did not receive this file see $value
Initial value:
{
parent::__construct('Received', $value)

◆ $value [5/5]

*See the enclosed file LICENSE for license information (LGPL). If you *did not receive this file see $value
Initial value:
{
parent::__construct('Subject', $value)

◆ Iterator

*See the enclosed file LICENSE for license information (LGPL). If you *did not receive this file see Iterator
Initial value:
{
protected boolean $_includeBase

◆ IteratorAggregate

***This file contains code adapted from PEAR s built in uudecode () method is broken. **@author Chuck Hagenbuch< chuck @horde.org > *@author Aidan Lister< aidan @php.net > *@author Michael Slusarz< slusarz @horde.org > *@author Michael Wallner< mike @php.net > *@category Horde *@copyright 2009-2017 Horde LLC *@copyright 2004-2007 Aidan Lister< aidan @php.net > Arpad Ray<arpad@php.net>* license IteratorAggregate
Initial value:
{
const UUENCODE_REGEX = "/begin ([0-7]{3}) (.+)\r?\n(.+)\r?\nend/Us"

◆ MIME_PARAM_QUOTED

const MIME_PARAM_QUOTED = '/[\x01-\x20\x22\x28\x29\x2c\x2f\x3a-\x40\x5b-\x5d]/'

◆ Serializable [1/3]

*See the enclosed file LICENSE for license information (LGPL). If you *did not receive this file see Serializable
Initial value:
{
const VERSION = 3

◆ Serializable [2/3]

*See the enclosed file LICENSE for license information (LGPL). If you *did not receive this file see Serializable
Initial value:
{
protected Horde_Support_CaseInsensitiveArray $_params
array $_params
Hash containing connection parameters.
Definition Base.php:152

◆ Serializable [3/3]

*See the enclosed file LICENSE for license information (LGPL). If you *did not receive this file see Serializable
Initial value:
{
const VERSION = 2

◆ UNKNOWN

const UNKNOWN = 'x-unknown'