本文整理汇总了PHP中eZMail::subject方法的典型用法代码示例。如果您正苦于以下问题:PHP eZMail::subject方法的具体用法?PHP eZMail::subject怎么用?PHP eZMail::subject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZMail
的用法示例。
在下文中一共展示了eZMail::subject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendMail
function sendMail(eZMail $mail)
{
$ini = eZINI::instance();
$sendmailOptions = '';
$emailFrom = $mail->sender();
$emailSender = isset($emailFrom['email']) ? $emailFrom['email'] : false;
if (!$emailSender || count($emailSender) <= 0) {
$emailSender = $ini->variable('MailSettings', 'EmailSender');
}
if (!$emailSender) {
$emailSender = $ini->variable('MailSettings', 'AdminEmail');
}
if (!eZMail::validate($emailSender)) {
$emailSender = false;
}
$isSafeMode = ini_get('safe_mode') != 0;
$sendmailOptionsArray = $ini->variable('MailSettings', 'SendmailOptions');
if (is_array($sendmailOptionsArray)) {
$sendmailOptions = implode(' ', $sendmailOptionsArray);
} elseif (!is_string($sendmailOptionsArray)) {
$sendmailOptions = $sendmailOptionsArray;
}
if (!$isSafeMode and $emailSender) {
$sendmailOptions .= ' -f' . $emailSender;
}
if ($isSafeMode and $emailSender and $mail->sender() == false) {
$mail->setSenderText($emailSender);
}
if (function_exists('mail')) {
$message = $mail->body();
$sys = eZSys::instance();
$excludeHeaders = array('Subject');
// If not Windows PHP mail() implementation, we can not specify a To: header in the $additional_headers parameter,
// because then there will be 2 To: headers in the resulting e-mail.
// However, we can use "undisclosed-recipients:;" in $to.
if ($sys->osType() != 'win32') {
$excludeHeaders[] = 'To';
$receiverEmailText = count($mail->ReceiverElements) > 0 ? $mail->receiverEmailText() : 'undisclosed-recipients:;';
} else {
$receiverEmailText = $mail->receiverEmailText();
}
// If in debug mode, send to debug email address and nothing else
if ($ini->variable('MailSettings', 'DebugSending') == 'enabled') {
$receiverEmailText = $ini->variable('MailSettings', 'DebugReceiverEmail');
$excludeHeaders[] = 'To';
$excludeHeaders[] = 'Cc';
$excludeHeaders[] = 'Bcc';
}
$extraHeaders = $mail->headerText(array('exclude-headers' => $excludeHeaders));
$returnedValue = mail($receiverEmailText, $mail->subject(), $message, $extraHeaders, $sendmailOptions);
if ($returnedValue === false) {
eZDebug::writeError('An error occurred while sending e-mail. Check the Sendmail error message for further information (usually in /var/log/messages)', __METHOD__);
}
return $returnedValue;
} else {
eZDebug::writeWarning("Unable to send mail: 'mail' function is not compiled into PHP.", __METHOD__);
}
return false;
}
示例2: testRegressionSubject
public function testRegressionSubject()
{
$mail = new eZMail();
$mail->setSubject(__FUNCTION__);
$ezpResult = $mail->subject();
$ezcResult = $mail->Mail->subject;
$expected = __FUNCTION__;
$this->assertEquals($expected, $ezpResult);
$this->assertEquals($expected, $ezcResult);
}