本文整理匯總了PHP中Zend_Mail::getType方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Mail::getType方法的具體用法?PHP Zend_Mail::getType怎麽用?PHP Zend_Mail::getType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Mail
的用法示例。
在下文中一共展示了Zend_Mail::getType方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _getHeaders
/**
* Return all mail headers as an array
*
* If a boundary is given, a multipart header is generated with a
* Content-Type of either multipart/alternative or multipart/mixed depending
* on the mail parts present in the {@link $_mail Zend_Mail object} present.
*
* @param string $boundary
* @return array
*/
protected function _getHeaders($boundary)
{
if (null !== $boundary) {
// Build multipart mail
$type = $this->_mail->getType();
if (!$type) {
if ($this->_mail->hasAttachments) {
$type = Zend_Mime::MULTIPART_MIXED;
} elseif ($this->_mail->getBodyText() && $this->_mail->getBodyHtml()) {
$type = Zend_Mime::MULTIPART_ALTERNATIVE;
} else {
$type = Zend_Mime::MULTIPART_MIXED;
}
}
$this->_headers['Content-Type'] = array(
$type . '; charset="' . $this->_mail->getCharset() . '";'
. $this->EOL
. " " . 'boundary="' . $boundary . '"'
);
$this->_headers['MIME-Version'] = array('1.0');
$this->boundary = $boundary;
}
return $this->_headers;
}
示例2: testTypeAccessor
public function testTypeAccessor()
{
$mail = new Zend_Mail();
$this->assertNull($mail->getType());
$mail->setType(Zend_Mime::MULTIPART_ALTERNATIVE);
$this->assertEquals(Zend_Mime::MULTIPART_ALTERNATIVE, $mail->getType());
$mail->setType(Zend_Mime::MULTIPART_RELATED);
$this->assertEquals(Zend_Mime::MULTIPART_RELATED, $mail->getType());
try {
$mail->setType('text/plain');
$this->fail('Invalid Zend_Mime type should throw an exception');
} catch (Exception $e) {
}
}