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


PHP Swift_Mime_Message::setTo方法代码示例

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


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

示例1: to

 /**
  * {@inheritdoc}
  */
 public function to($address, string $name = null, bool $override = false) : MessageContract
 {
     if ($override) {
         $this->swift->setTo($address, $name);
         return $this;
     }
     return $this->addAddresses($address, $name, 'To');
 }
开发者ID:narrowspark,项目名称:framework,代码行数:11,代码来源:Message.php

示例2: _restoreMessage

 private function _restoreMessage(Swift_Mime_Message $message)
 {
     // restore original headers
     $headers = $message->getHeaders();
     if ($headers->has('X-Swift-To')) {
         $message->setTo($headers->get('X-Swift-To')->getNameAddresses());
         $headers->removeAll('X-Swift-To');
     }
     if ($headers->has('X-Swift-Cc')) {
         $message->setCc($headers->get('X-Swift-Cc')->getNameAddresses());
         $headers->removeAll('X-Swift-Cc');
     }
     if ($headers->has('X-Swift-Bcc')) {
         $message->setBcc($headers->get('X-Swift-Bcc')->getNameAddresses());
         $headers->removeAll('X-Swift-Bcc');
     }
 }
开发者ID:JamesLinus,项目名称:platform,代码行数:17,代码来源:RedirectingPlugin.php

示例3: batchSend

 /**
  * Send the given Message to all recipients individually.
  * 
  * This differs from {@link send()} in the way headers are presented to the
  * recipient.  The only recipient in the "To:" field will be the individual
  * recipient it was sent to.
  * 
  * If an iterator is provided, recipients will be read from the iterator
  * one-by-one, otherwise recipient data will be retreived from the Message
  * object.
  * 
  * Sender information is always read from the Message object.
  * 
  * The return value is the number of recipients who were accepted for
  * delivery.
  * 
  * @param Swift_Mime_Message $message
  * @param array &$failedRecipients, optional
  * @param Swift_Mailer_RecipientIterator $it, optional
  * @return int
  * @see send()
  */
 public function batchSend(Swift_Mime_Message $message, &$failedRecipients = null, Swift_Mailer_RecipientIterator $it = null)
 {
     $failedRecipients = (array) $failedRecipients;
     $sent = 0;
     $to = $message->getTo();
     $cc = $message->getCc();
     $bcc = $message->getBcc();
     if (!empty($cc)) {
         $message->setCc(array());
     }
     if (!empty($bcc)) {
         $message->setBcc(array());
     }
     //Use an iterator if set
     if (isset($it)) {
         while ($it->hasNext()) {
             $message->setTo($it->nextRecipient());
             $sent += $this->send($message, $failedRecipients);
         }
     } else {
         foreach ($to as $address => $name) {
             $message->setTo(array($address => $name));
             $sent += $this->send($message, $failedRecipients);
         }
     }
     $message->setTo($to);
     if (!empty($cc)) {
         $message->setCc($cc);
     }
     if (!empty($bcc)) {
         $message->setBcc($bcc);
     }
     return $sent;
 }
开发者ID:fobihz,项目名称:cndiesel,代码行数:56,代码来源:Mailer.php

示例4: init

 /**
  * init the mailer into mail queue
  *
  * @param \Swift_Mime_Message $message  E-mail message
  * @param string              $from     The from value
  * @param mixed               $to       The to value
  * @param mixed               $cc       The cc value
  * @param mixed               $bcc      The bcc value
  * @param string              $replayto The replayto value
  * @param string              $subject  The subject value
  * @param array               $body     The body value
  * @param mixed               $sender   The sender value
  *
  * @access public
  * @return void
  * @author Etienne de Longeaux <etienne.delongeaux@gmail.com>
  */
 public function init(\Swift_Mime_Message &$message, $from, $to, $cc, $bcc, $replayto, $subject, $body, $sender)
 {
     if (is_string($cc)) {
         $cc_new = $this->container->get('sfynx.tool.regex_manager')->verifByRegularExpression($cc, 'mail', PREG_SPLIT_NO_EMPTY);
         if (is_array($cc_new) && count($cc_new) == 1 && count($cc_new[0]) >= 1) {
             $cc = $cc_new[0];
         } else {
             $cc = null;
         }
     }
     if (is_string($bcc)) {
         $bcc_new = $this->container->get('sfynx.tool.regex_manager')->verifByRegularExpression($bcc, 'mail', PREG_SPLIT_NO_EMPTY);
         if (is_array($bcc_new) && count($bcc_new) == 1 && count($bcc_new[0]) >= 1) {
             $bcc = $bcc_new[0];
         } else {
             $cc = null;
         }
     }
     try {
         $message->setTo($to)->setFrom($from)->setSender($sender)->setCc($cc)->setBcc($bcc)->setReplyTo($replayto)->setSubject($subject)->setBody($body, 'text/html');
     } catch (\Exception $e) {
         return false;
     }
 }
开发者ID:pigroupe,项目名称:SfynxToolBundle,代码行数:41,代码来源:PiMailerManager.php


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