本文整理汇总了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) {
}
}