File indexing completed on 2024-05-26 06:03:11

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Mail
0017  * @subpackage Storage
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id$
0021  */
0022 
0023 
0024 /**
0025  * @category   Zend
0026  * @package    Zend_Mail
0027  * @subpackage Storage
0028  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0029  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0030  */
0031 
0032 interface Zend_Mail_Part_Interface extends RecursiveIterator
0033 {
0034     /**
0035      * Check if part is a multipart message
0036      *
0037      * @return bool if part is multipart
0038      */
0039     public function isMultipart();
0040 
0041 
0042     /**
0043      * Body of part
0044      *
0045      * If part is multipart the raw content of this part with all sub parts is returned
0046      *
0047      * @return string body
0048      * @throws Zend_Mail_Exception
0049      */
0050     public function getContent();
0051 
0052     /**
0053      * Return size of part
0054      *
0055      * @return int size
0056      */
0057     public function getSize();
0058 
0059     /**
0060      * Get part of multipart message
0061      *
0062      * @param  int $num number of part starting with 1 for first part
0063      * @return Zend_Mail_Part wanted part
0064      * @throws Zend_Mail_Exception
0065      */
0066     public function getPart($num);
0067 
0068     /**
0069      * Count parts of a multipart part
0070      *
0071      * @return int number of sub-parts
0072      */
0073     public function countParts();
0074 
0075 
0076     /**
0077      * Get all headers
0078      *
0079      * The returned headers are as saved internally. All names are lowercased. The value is a string or an array
0080      * if a header with the same name occurs more than once.
0081      *
0082      * @return array headers as array(name => value)
0083      */
0084     public function getHeaders();
0085 
0086     /**
0087      * Get a header in specificed format
0088      *
0089      * Internally headers that occur more than once are saved as array, all other as string. If $format
0090      * is set to string implode is used to concat the values (with Zend_Mime::LINEEND as delim).
0091      *
0092      * @param  string $name   name of header, matches case-insensitive, but camel-case is replaced with dashes
0093      * @param  string $format change type of return value to 'string' or 'array'
0094      * @return string|array value of header in wanted or internal format
0095      * @throws Zend_Mail_Exception
0096      */
0097     public function getHeader($name, $format = null);
0098 
0099     /**
0100      * Get a specific field from a header like content type or all fields as array
0101      *
0102      * If the header occurs more than once, only the value from the first header
0103      * is returned.
0104      *
0105      * Throws a Zend_Mail_Exception if the requested header does not exist. If
0106      * the specific header field does not exist, returns null.
0107      *
0108      * @param  string $name       name of header, like in getHeader()
0109      * @param  string $wantedPart the wanted part, default is first, if null an array with all parts is returned
0110      * @param  string $firstName  key name for the first part
0111      * @return string|array wanted part or all parts as array($firstName => firstPart, partname => value)
0112      * @throws Zend_Exception, Zend_Mail_Exception
0113      */
0114     public function getHeaderField($name, $wantedPart = 0, $firstName = 0);
0115 
0116 
0117     /**
0118      * Getter for mail headers - name is matched in lowercase
0119      *
0120      * This getter is short for Zend_Mail_Part::getHeader($name, 'string')
0121      *
0122      * @see Zend_Mail_Part::getHeader()
0123      *
0124      * @param  string $name header name
0125      * @return string value of header
0126      * @throws Zend_Mail_Exception
0127      */
0128     public function __get($name);
0129 
0130     /**
0131      * magic method to get content of part
0132      *
0133      * @return string content
0134      */
0135     public function __toString();
0136 }