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


PHP UserMailer::quotedPrintable方法代码示例

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


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

示例1: toString

 /**
  * Return formatted and quoted address to insert into SMTP headers
  * @return string
  */
 function toString()
 {
     # PHP's mail() implementation under Windows is somewhat shite, and
     # can't handle "Joe Bloggs <joe@bloggs.com>" format email addresses,
     # so don't bother generating them
     if ($this->address) {
         if ($this->name != '' && !wfIsWindows()) {
             global $wgEnotifUseRealName;
             $name = $wgEnotifUseRealName && $this->realName ? $this->realName : $this->name;
             $quoted = UserMailer::quotedPrintable($name);
             if (strpos($quoted, '.') !== false || strpos($quoted, ',') !== false) {
                 $quoted = '"' . $quoted . '"';
             }
             return "{$quoted} <{$this->address}>";
         } else {
             return $this->address;
         }
     }
 }
开发者ID:natalieschauser,项目名称:csp_media_wiki,代码行数:23,代码来源:UserMailer.php

示例2: send

 public static function send($headers, $to, $from, $subject, $body, $priority = 0, $attachments = null)
 {
     global $wgEnotifMaxRecips, $wgSMTP;
     wfProfileIn(__METHOD__);
     require_once 'Mail2.php';
     require_once 'Mail2/mime.php';
     $logContext = array_merge($headers, ['issue' => 'SOC-910', 'method' => __METHOD__, 'to' => $to, 'subject' => $subject]);
     WikiaLogger::instance()->info('Queuing email for SendGrid', $logContext);
     wfSuppressWarnings();
     $headers['Subject'] = UserMailer::quotedPrintable($subject);
     // Add a header for the server-name (helps us route where SendGrid will send bounces).
     if (!empty($_SERVER) && isset($_SERVER['SERVER_NAME'])) {
         $headers["X-ServerName"] = $_SERVER['SERVER_NAME'];
     }
     try {
         $mail_object =& Mail2::factory(WikiaSendgridMailer::$factory, $wgSMTP);
     } catch (Exception $e) {
         $logContext['errorMessage'] = $e->getMessage();
         WikiaLogger::instance()->info('Failed to create mail object', $logContext);
         wfDebug("PEAR::Mail factory failed: " . $e->getMessage() . "\n");
         wfRestoreWarnings();
         wfProfileOut(__METHOD__);
         return $e->getMessage();
     }
     $email_body_txt = $email_body_html = "";
     if (is_array($body)) {
         if (isset($body['text'])) {
             $email_body_txt = $body['text'];
         }
         if (isset($body['html'])) {
             $email_body_html = $body['html'];
         }
     } else {
         $email_body_txt = $body;
     }
     $mime = new Mail_mime();
     $mime->setTXTBody($email_body_txt);
     $params = array('head_charset' => 'UTF-8', 'html_charset' => 'UTF-8', 'text_charset' => 'UTF-8', 'text_encoding' => 'quoted-printable', 'html_encoding' => 'quoted-printable');
     # send email with attachements
     if (!empty($attachments)) {
         if (!is_array($attachments)) {
             $attachments = array($attachments);
         }
         foreach ($attachments as $file) {
             if (!is_array($file)) {
                 $magic = MimeMagic::singleton();
                 $mimeType = $magic->guessMimeType($file);
                 $ext_file = end(explode('.', $file));
                 $file = array('file' => $file, 'ext' => $ext_file, 'mime' => $mimeType);
             }
             $filename = $file['file'];
             $ext_filename = $file['ext'];
             if (!file_exists($filename)) {
                 continue;
             }
             $name = $filename;
             #basename( $filename );
             if ($ext_filename) {
                 $name = $filename . "." . $ext_filename;
             }
             $mime->addAttachment($filename, $file['mime'], $name);
         }
     }
     # Old version (1.16 MW with Wikia changes) of sendHTML method
     if ($email_body_html) {
         $mime->setHTMLBody($email_body_html);
         //do not ever try to call these lines in reverse order
     }
     $body = $mime->get($params);
     $headers = $mime->headers($headers);
     wfDebug("Sending mail via WikiaSendgridMailer::send\n");
     $chunks = array_chunk((array) $to, $wgEnotifMaxRecips);
     foreach ($chunks as $chunk) {
         $headers['To'] = $chunk;
         $status = self::sendWithPear($mail_object, $chunk, $headers, $body);
         if (!$status->isOK()) {
             $logContext['errorMessage'] = $status->getMessage();
             WikiaLogger::instance()->info('Failed to create mail object', $logContext);
             wfRestoreWarnings();
             wfProfileOut(__METHOD__);
             return $status->getMessage();
         }
     }
     wfProfileOut(__METHOD__);
     # return false to return Status::newGood() in UserMailer::send method
     return false;
 }
开发者ID:yusufchang,项目名称:app,代码行数:87,代码来源:WikiaMailer.php

示例3: testQuotedPrintable

 /**
  * @covers UserMailer::quotedPrintable
  */
 public function testQuotedPrintable()
 {
     $this->assertEquals("=?UTF-8?Q?=C4=88u=20legebla=3F?=", UserMailer::quotedPrintable("Ĉu legebla?", "UTF-8"));
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:7,代码来源:UserMailerTest.php


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