当前位置: 首页>>代码示例>>PHP>>正文


PHP eZMail::headerText方法代码示例

本文整理汇总了PHP中eZMail::headerText方法的典型用法代码示例。如果您正苦于以下问题:PHP eZMail::headerText方法的具体用法?PHP eZMail::headerText怎么用?PHP eZMail::headerText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZMail的用法示例。


在下文中一共展示了eZMail::headerText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendMail

 function sendMail(eZMail $mail)
 {
     $ini = eZINI::instance();
     $sendmailOptions = '';
     $emailFrom = $mail->sender();
     $emailSender = $emailFrom['email'];
     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');
     if ($isSafeMode and $emailSender and $mail->sender() == false) {
         $mail->setSenderText($emailSender);
     }
     $filename = time() . '-' . mt_rand() . '.mail';
     $data = preg_replace('/(\\r\\n|\\r|\\n)/', "\r\n", $mail->headerText() . "\n" . $mail->body());
     $returnedValue = eZFile::create($filename, 'var/log/mail', $data);
     if ($returnedValue === false) {
         eZDebug::writeError('An error occurred writing the e-mail file in var/log/mail', __METHOD__);
     }
     return $returnedValue;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:27,代码来源:ezfiletransport.php

示例2: 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;
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:59,代码来源:ezsendmailtransport.php


注:本文中的eZMail::headerText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。