/** * Public constructor * * In addition to the parameters of Zend_Mail_Part::__construct() this constructor supports: * - file filename or file handle of a file with raw message content * * @param string $rawMessage full message with or without headers * @throws Zend_Mail_Exception */ public function __construct(array $params) { if (isset($params['file'])) { if (!is_resource($params['file'])) { $params['raw'] = @file_get_contents($params['file']); if ($params['raw'] === false) { throw new Zend_Mail_Exception('could not open file'); } } else { $params['raw'] = stream_get_contents($params['file']); } } parent::__construct($params); }
/** * Public constructor * * In addition to the parameters of Zend_Mail_Part::__construct() this constructor supports: * - file filename or file handle of a file with raw message content * - flags array with flags for message, keys are ignored, use constants defined in Zend_Mail_Storage * * @param string $rawMessage full message with or without headers * @throws Zend_Mail_Exception */ public function __construct(array $params) { if (isset($params['file'])) { if (!is_resource($params['file'])) { $params['raw'] = @file_get_contents($params['file']); if ($params['raw'] === false) { throw new Zend_Mail_Exception('could not open file'); } } else { $params['raw'] = stream_get_contents($params['file']); } } if (!empty($params['flags'])) { // set key and value to the same value for easy lookup $this->_flags = array_combine($params['flags'], $params['flags']); } parent::__construct($params); }
/** * Public constructor * * In addition to the parameters of Zend_Mail_Part::__construct() this constructor supports: * - file filename or file handle of a file with raw message content * - flags array with flags for message, keys are ignored, use constants defined in Zend_Mail_Storage * * @param string $rawMessage full message with or without headers * @throws Zend_Mail_Exception */ public function __construct(array $params) { if (isset($params['file'])) { if (!is_resource($params['file'])) { $params['raw'] = @file_get_contents($params['file']); if ($params['raw'] === false) { /** * @see Zend_Mail_Exception */ require_once PHP_LIBRARY_PATH . 'Zend/Mail/Exception.php'; throw new Zend_Mail_Exception('could not open file'); } } else { $params['raw'] = stream_get_contents($params['file']); } } if (!empty($params['flags'])) { // set key and value to the same value for easy lookup $this->_flags = array_merge($this->_flags, array_combine($params['flags'], $params['flags'])); } parent::__construct($params); }
/** * Public constructor * * In addition to the parameters of Zend_Mail_Part::__construct() this constructor supports: * - file filename or file handle of a file with raw message content * - flags array with flags for message, keys are ignored, use constants defined in Zend_Mail_Storage * * @param string $rawMessage full message with or without headers * @throws Zend_Mail_Exception */ public function __construct(array $params) { if (isset($params['file'])) { if (!is_resource($params['file'])) { $params['raw'] = @file_get_contents($params['file']); if ($params['raw'] === false) { /** * @see Zend_Mail_Exception */ throw new Zend_Mail_Exception('could not open file'); } } else { $params['raw'] = stream_get_contents($params['file']); } $params['raw'] = preg_replace("/(?<!\r)\n/", "\r\n", $params['raw']); } if (!empty($params['flags'])) { // set key and value to the same value for easy lookup $this->_flags = array_merge($this->_flags, array_combine($params['flags'], $params['flags'])); } parent::__construct($params); }