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


PHP ezcMailTools::composeEmailAddresses方法代码示例

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


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

示例1: testComposeEmailAddressesMultiFolding

 public function testComposeEmailAddressesMultiFolding()
 {
     $reference = "John Doe <john@example.com>, Harry Doe <harry@example.com>," . ezcMailTools::lineBreak() . " Nancy Doe <nancy@example.com>, Faith Doe <faith@example.com>," . ezcMailTools::lineBreak() . " Gordon Doe <gordon@example.com>, debra@example.com";
     $addresses = array(new ezcMailAddress('john@example.com', 'John Doe'), new ezcMailAddress('harry@example.com', 'Harry Doe'), new ezcMailAddress('nancy@example.com', 'Nancy Doe'), new ezcMailAddress('faith@example.com', 'Faith Doe'), new ezcMailAddress('gordon@example.com', 'Gordon Doe'), new ezcMailAddress('debra@example.com'));
     $result = ezcMailTools::composeEmailAddresses($addresses, 76);
     $this->assertEquals($reference, $result);
 }
开发者ID:jacomyma,项目名称:GEXF-Atlas,代码行数:7,代码来源:tools_test.php

示例2: send

 /**
  * Sends the mail $mail using the PHP mail method.
  *
  * Note that a message may not arrive at the destination even though
  * it was accepted for delivery.
  *
  * @throws ezcMailTransportException
  *         if the mail was not accepted for delivery by the MTA.
  * @param ezcMail $mail
  */
 public function send(ezcMail $mail)
 {
     $mail->appendExcludeHeaders(array('to', 'subject'));
     $headers = rtrim($mail->generateHeaders());
     // rtrim removes the linebreak at the end, mail doesn't want it.
     if (count($mail->to) + count($mail->cc) + count($mail->bcc) < 1) {
         throw new ezcMailTransportException('No recipient addresses found in message header.');
     }
     $additionalParameters = "";
     if (isset($mail->returnPath)) {
         $additionalParameters = "-f{$mail->returnPath->email}";
     }
     $success = mail(ezcMailTools::composeEmailAddresses($mail->to), $mail->getHeader('Subject'), $mail->generateBody(), $headers, $additionalParameters);
     if ($success === false) {
         throw new ezcMailTransportException('The email could not be sent by sendmail');
     }
 }
开发者ID:mdb-webdev,项目名称:livehelperchat,代码行数:27,代码来源:mta_transport.php

示例3: generateHeaders

 /**
  * Returns the generated headers for the mail.
  *
  * This method is called automatically when the mail message is built.
  * You can re-implement this method in subclasses if you wish to set
  * different mail headers than ezcMail.
  *
  * @return string
  */
 public function generateHeaders()
 {
     // set our headers first.
     if ($this->from !== null) {
         $this->setHeader("From", ezcMailTools::composeEmailAddress($this->from));
     }
     if ($this->to !== null) {
         $this->setHeader("To", ezcMailTools::composeEmailAddresses($this->to));
     }
     if (count($this->cc)) {
         $this->setHeader("Cc", ezcMailTools::composeEmailAddresses($this->cc));
     }
     if (count($this->bcc)) {
         $this->setHeader("Bcc", ezcMailTools::composeEmailAddresses($this->bcc));
     }
     $this->setHeader('Subject', $this->subject, $this->subjectCharset);
     $this->setHeader('MIME-Version', '1.0');
     $this->setHeader('User-Agent', 'eZ Components');
     $this->setHeader('Date', date('r'));
     $idhost = $this->from != null && $this->from->email != '' ? $this->from->email : 'localhost';
     if (is_null($this->messageId)) {
         $this->setHeader('Message-Id', '<' . ezcMailTools::generateMessageId($idhost) . '>');
     } else {
         $this->setHeader('Message-Id', $this->messageID);
     }
     // if we have a body part, include the headers of the body
     if (is_subclass_of($this->body, "ezcMailPart")) {
         return parent::generateHeaders() . $this->body->generateHeaders();
     }
     return parent::generateHeaders();
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:40,代码来源:mail.php

示例4: array

<?php

require_once 'tutorial_autoload.php';
$mailAddresses = array(new ezcMailAddress('john@example.com', 'Jøhn Doe', 'ISO-8859-1'), new ezcMailAddress('jane@example.com', 'Jane Doe'));
$addresses = '=?ISO-8859-1?B?SsO4aG4gRG9l?= <john@example.com>, Jane Doe <jane@example.com';
// Convert ezcMailAddress to string representation
var_dump(ezcMailTools::composeEmailAddress($mailAddresses[0]));
var_dump(ezcMailTools::composeEmailAddresses($mailAddresses));
// Convert string to ezcMailAddress
var_dump(ezcMailTools::parseEmailAddress($addresses));
var_dump(ezcMailTools::parseEmailAddresses($addresses));
// Validate an email address (with a regular expression, without checking for MX records)
$isValid = ezcMailTools::validateEmailAddress('john.doe@example.com');
// Validate an email address with MX records check.
// MX record checking does not work on Windows due to the lack of getmxrr()
// and checkdnsrr() PHP functions. The ezcBaseFunctionalityNotSupportedException
// is thrown in this case.
// set this to your mail server, it is used in a
// 'HELO SMTP' command to validate against MX records
ezcMailTools::$mxValidateServer = 'your.mail.server';
// set this to a mail address such as 'postmaster@example.com', it is used in a
// 'MAIL FROM' SMTP command to validate against MX records
ezcMailTools::$mxValidateAddress = 'email.address@mail.server';
$isValid = ezcMailTools::validateEmailAddress('john.doe@example.com', true);
// Create a new mail object
$mail = new ezcMail();
$mail->from = $mailAddresses[1];
$mail->addTo($mailAddresses[0]);
$mail->subject = "Top secret";
// Use the lineBreak() method
$mail->body = new ezcMailText("Confidential" . ezcMailTools::lineBreak() . "DO NOT READ");
开发者ID:notion,项目名称:zeta-mail,代码行数:31,代码来源:tutorial_tools.php


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