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


PHP Zend_Mail::getRecipients方法代码示例

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


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

示例1: sendMail

 public function sendMail(Zend_Mail $mail, $body, $headers)
 {
     /**
      * @todo error checking
      */
     mail(join(',', $mail->getRecipients()), $mail->getSubject(), $body, $headers);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:7,代码来源:Sendmail.php

示例2: sendMail

 public function sendMail(Zend_Mail $mail, $body, $header)
 {
     $this->mail = $mail;
     $this->body = $body;
     $this->header = $header;
     $this->recipients = $mail->getRecipients();
     $this->subject = $mail->getSubject();
     $this->from = $mail->getFrom();
     $this->called = true;
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:10,代码来源:MailTest.php

示例3: send

 public function send($template, array $values = array())
 {
     // create a new mail
     $mail = new Zend_Mail('UTF-8');
     if (isset($values['to'])) {
         if (is_array($values['to'])) {
             foreach ($values['to'] as $address) {
                 $mail->addTo($address);
             }
         } else {
             $mail->addTo($values['to']);
         }
         unset($values['to']);
     } else {
         throw new Exception('to not send in $values');
     }
     // set cc
     if (isset($values['cc'])) {
         if (is_array($values['cc'])) {
             foreach ($values['cc'] as $address) {
                 $mail->addCc($address);
             }
         } else {
             $mail->addCc($values['cc']);
         }
         unset($values['cc']);
     }
     // set bcc
     if (isset($values['bcc'])) {
         if (is_array($values['bcc'])) {
             foreach ($values['bcc'] as $address) {
                 $mail->addBcc($address);
             }
         } else {
             $mail->addBcc($values['bcc']);
         }
         unset($values['bcc']);
     }
     // get the template
     $templateModel = new Core_Model_Templates();
     $data = $templateModel->show($template, $values);
     // set subject and body
     $mail->setSubject($data['subject']);
     $mail->setBodyText($data['body']);
     if (empty(Daiquiri_Config::getInstance()->mail->debug)) {
         $mail->send();
     } else {
         Zend_Debug::dump($mail->getRecipients());
         Zend_Debug::dump($mail->getSubject());
         Zend_Debug::dump($mail->getBodyText());
     }
 }
开发者ID:vrtulka23,项目名称:daiquiri,代码行数:52,代码来源:Mail.php

示例4: sendMessage

 /**
  * Send a mail using this transport
  *
  * @return void
  * @throws \Magento\Framework\Exception\MailException
  */
 public function sendMessage()
 {
     try {
         $sendpulseClient = null;
         $recipients = implode(',', $this->_message->getRecipients());
         $parameters = array('from' => $this->_message->getFrom(), 'to' => $recipients, 'subject' => quoted_printable_decode($this->_message->getSubject()), 'text' => quoted_printable_decode($this->_message->getBodyText(true)), 'html' => quoted_printable_decode($this->_message->getBodyHtml(true)));
         // TODO add attachment support
         $attachments = array();
         /*
         $attachments = array(
             'attachment' => array(
                 '/path/to/file.txt',
                 '/path/to/file.txt'
             )
         );
         */
         # Make the call to the client.
         $result = $sendpulseClient->sendMessage($this->_config->getMailgunDomain(), $parameters, $attachments);
     } catch (\Exception $e) {
         throw new \Magento\Framework\Exception\MailException(new \Magento\Framework\Phrase($e->getMessage()), $e);
     }
 }
开发者ID:shockwave-design,项目名称:magento2-module-mail-sendpulse,代码行数:28,代码来源:SendpulseTransport.php

示例5: mailProvider

 public function mailProvider()
 {
     $data = array();
     $mail = new Zend_Mail();
     $mail->setSubject('Some Mail to log');
     $mail->addTo('email@example.com');
     $mail->setBodyText('Some Text');
     $mail->setBodyHtml('<div>Some Html</div>');
     $message = 'Subject: ' . $mail->getSubject() . PHP_EOL;
     $message .= 'To: ' . implode(', ', $mail->getRecipients()) . PHP_EOL;
     $message .= 'Text: ' . $mail->getBodyText()->getContent() . PHP_EOL . PHP_EOL;
     $message .= 'Html: ' . $mail->getBodyHtml()->getContent();
     $data[] = array($mail, $message);
     return $data;
 }
开发者ID:robo47,项目名称:robo47-components,代码行数:15,代码来源:SimpleTest.php

示例6: sendMessage

 /**
  * Send a mail using this transport
  *
  * @return void
  * @throws \Magento\Framework\Exception\MailException
  */
 public function sendMessage()
 {
     try {
         /** @var Client $client */
         $client = new Client();
         /** @var $mailgunClient Mailgun */
         $mailgunClient = new Mailgun($this->_config->getMailgunKey(), $client);
         /** @var string $recipients comma separated */
         $recipients = implode(',', $this->_message->getRecipients());
         // Assign default parameters
         $parameters = array('from' => $this->_message->getFrom(), 'to' => $recipients, 'subject' => $this->decodeZendQuotedPrintableHeader($this->_message->getSubject()), 'text' => quoted_printable_decode($this->_message->getBodyText(true)), 'html' => quoted_printable_decode($this->_message->getBodyHtml(true)));
         $parameters = $this->assignOptionalParameters($parameters);
         /** @var array $postFiles */
         $postFiles = $this->getPostFiles();
         $domain = $this->_config->getMailgunDomain();
         $result = $mailgunClient->sendMessage($domain, $parameters, $postFiles);
         $this->getMail()->setResult($result);
         $this->getMail()->setSent($this->createSent())->setSentAt($this->createSentAt())->setTransportId($this->createTransportId());
     } catch (\Exception $e) {
         throw new \Magento\Framework\Exception\MailException(new \Magento\Framework\Phrase($e->getMessage()), $e);
     }
 }
开发者ID:shockwave-design,项目名称:magento2-module-mail-mailgun,代码行数:28,代码来源:MailgunTransport.php

示例7: send

 /**
  * Send a mail using this transport
  *
  * @param  Zend_Mail $mail
  * @access public
  * @return void
  * @throws Zend_Mail_Transport_Exception if mail is empty
  */
 public function send(Zend_Mail $mail)
 {
     $this->_isMultipart = false;
     $this->_mail = $mail;
     $this->_parts = $mail->getParts();
     $mime = $mail->getMime();
     // Build body content
     $this->_buildBody();
     // Determine number of parts and boundary
     $count = count($this->_parts);
     $boundary = null;
     if ($count < 1) {
         /**
          * @see Zend_Mail_Transport_Exception
          */
         // require_once 'Zend/Mail/Transport/Exception.php';
         throw new Zend_Mail_Transport_Exception('Empty mail cannot be sent');
     }
     if ($count > 1) {
         // Multipart message; create new MIME object and boundary
         $mime = new Zend_Mime($this->_mail->getMimeBoundary());
         $boundary = $mime->boundary();
     } elseif ($this->_isMultipart) {
         // multipart/alternative -- grab boundary
         $boundary = $this->_parts[0]->boundary;
     }
     // Determine recipients, and prepare headers
     $this->recipients = implode(',', $mail->getRecipients());
     $this->_prepareHeaders($this->_getHeaders($boundary));
     // Create message body
     // This is done so that the same Zend_Mail object can be used in
     // multiple transports
     $message = new Zend_Mime_Message();
     $message->setParts($this->_parts);
     $message->setMime($mime);
     $this->body = $message->generateMessage($this->EOL);
     // Send to transport!
     $this->_sendMail();
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:47,代码来源:Abstract.php

示例8: getRawMessage

 /**
  * get raw message as string
  * 
  * @param Zend_Mail $mail
  * @param array $_additionalHeaders
  * @return string
  */
 public function getRawMessage(Zend_Mail $mail = NULL, $_additionalHeaders = array())
 {
     if ($mail !== NULL) {
         // this part is from Zend_Mail_Transport_Abstract::send()
         $this->_isMultipart = false;
         $this->_mail = $mail;
         $this->_parts = $mail->getParts();
         $mime = $mail->getMime();
         // Build body content
         $this->_buildBody();
         // Determine number of parts and boundary
         $count = count($this->_parts);
         $boundary = null;
         if ($count < 1) {
             /**
              * @see Zend_Mail_Transport_Exception
              */
             require_once 'Zend/Mail/Transport/Exception.php';
             throw new Zend_Mail_Transport_Exception('Mail is empty');
         }
         if ($count > 1) {
             // Multipart message; create new MIME object and boundary
             $mime = new Zend_Mime($this->_mail->getMimeBoundary());
             $boundary = $mime->boundary();
         } elseif ($this->_isMultipart) {
             // multipart/alternative -- grab boundary
             $boundary = $this->_parts[0]->boundary;
         }
         // Determine recipients, and prepare headers
         $this->recipients = implode(',', $mail->getRecipients());
         $this->_prepareHeaders($this->_getHeaders($boundary));
         // Create message body
         // This is done so that the same Zend_Mail object can be used in
         // multiple transports
         $message = new Zend_Mime_Message();
         $message->setParts($this->_parts);
         $message->setMime($mime);
         $this->body = $message->generateMessage($this->EOL);
     }
     $mailAsString = $this->getHeaders($_additionalHeaders) . $this->EOL . $this->getBody();
     // convert \n to \r\n
     $mailAsString = preg_replace("/(?<!\\r)\\n(?!\\r)/", "\r\n", $mailAsString);
     return $mailAsString;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:51,代码来源:Transport.php

示例9: sendRaw

 public function sendRaw(Zend_Mail $mail)
 {
     if ($this->_enabled) {
         try {
             $mail->send($this->getTransport());
         } catch (Exception $e) {
             // Silence? Note: Engine_Exception 's are already logged
             if (!$e instanceof Engine_Exception && Zend_Registry::isRegistered('Zend_Log')) {
                 $log = Zend_Registry::get('Zend_Log');
                 $log->log($e, Zend_Log::ERR);
             }
         }
         // Logging in dev mode
         if ('development' == APPLICATION_ENV) {
             $this->getLog()->log(sprintf('[%s] %s <- %s', 'Zend', join(', ', $mail->getRecipients()), $mail->getFrom()), Zend_Log::DEBUG);
         }
         // Track emails
         Engine_Api::_()->getDbtable('statistics', 'core')->increment('core.emails');
     }
     return $this;
 }
开发者ID:HiLeo1610,项目名称:tumlumsach,代码行数:21,代码来源:Mail.php

示例10: testReplyToIsNoRecipient

 /**
  * @group ZF-7702
  */
 public function testReplyToIsNoRecipient()
 {
     $mail = new Zend_Mail();
     $mail->setReplyTo('foo@example.com', 'foobar');
     $this->assertEquals(0, count($mail->getRecipients()));
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:9,代码来源:MailTest.php

示例11: SEND_SMTP_ZEND

 private function SEND_SMTP_ZEND()
 {
     try {
         Server::LoadLibrary("ZEND", "Zend_Mail");
         Server::LoadLibrary("ZEND", "Zend_Mail_Transport_Smtp");
         if (empty($this->MailBodyText)) {
             $this->MailBodyText = ">>";
         }
         if ($this->Mailbox->Authentication == "No") {
             $config = array('port' => $this->Mailbox->Port);
         } else {
             $config = array('auth' => 'login', 'username' => $this->Mailbox->Username, 'password' => $this->Mailbox->Password, 'port' => $this->Mailbox->Port);
         }
         if (!empty($this->Mailbox->SSL)) {
             $config['ssl'] = $this->Mailbox->SSL == 1 ? 'SSL' : 'TLS';
         }
         $transport = new Zend_Mail_Transport_Smtp($this->Mailbox->Host, $config);
         $mail = new Zend_Mail('UTF-8');
         $mail->setBodyText($this->MailBodyText);
         if (!empty($this->MailBodyHTML)) {
             $mail->setBodyHtml($this->MailBodyHTML);
         }
         if (empty($this->FakeSender)) {
             $mail->setFrom($this->Mailbox->Email, $this->Mailbox->SenderName);
         } else {
             $mail->setFrom($this->FakeSender, $this->FakeSender);
         }
         if (strpos($this->Receiver, ",") !== false) {
             $emails = explode(",", $this->Receiver);
             $add = false;
             foreach ($emails as $mailrec) {
                 if (!empty($mailrec) && !Is::Null(strpos($mailrec, "@"))) {
                     if (!$add) {
                         $add = true;
                         $mail->addTo($mailrec, $mailrec);
                     } else {
                         $mail->addBcc($mailrec, $mailrec);
                     }
                 }
             }
         } else {
             if (!Is::Null(strpos($this->Receiver, "@"))) {
                 $mail->addTo($this->Receiver, $this->Receiver);
             }
         }
         $mail->setSubject($this->Subject);
         $mail->setReplyTo($this->ReplyTo, $name = null);
         if (count($mail->getRecipients()) > 0) {
             if ($this->Attachments != null) {
                 foreach ($this->Attachments as $resId => $val) {
                     $res = KnowledgeBaseEntry::GetById($resId);
                     $at = $mail->createAttachment(file_get_contents("./uploads/" . $res["value"]));
                     $at->type = 'application/octet-stream';
                     $at->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
                     $at->encoding = Zend_Mime::ENCODING_BASE64;
                     $at->filename = $res["title"];
                 }
             }
             $mail->send($transport);
         }
     } catch (Exception $e) {
         if ($this->TestIt) {
             throw $e;
         } else {
             handleError("111", $this->Mailbox->Host . " send mail connection error: " . $e->getMessage(), "functions.global.inc.php", 0);
         }
         return 0;
     }
     return 1;
 }
开发者ID:sgh1986915,项目名称:laravel-eyerideonline,代码行数:70,代码来源:objects.mail.inc.php

示例12: _performSend

 /**
  * Actually sends the email.  Redirects to dev if needed.
  * 
  * @param Zend_Mail $mail
  */
 private function _performSend($mail)
 {
     if (APPLICATION_ENV == 'production' || APPLICATION_ENV == 'staging') {
         try {
             $mail->send();
             $this->_logger->notice('Send Email: email addressed to ' . implode(',', $mail->getRecipients()));
         } catch (Exception $e) {
             $this->_logger->crit('Send Email: Error sending email to ' . implode(',', $mail->getRecipients()));
         }
     } else {
         // development has all emails redirected to the default recipient
         $auth = Zend_Auth::getInstance();
         $mail = $this->_prepareDevEmail($mail);
         // add a dev note to top of email
         $mail->clearRecipients();
         $mail->addTo($this->_config->email->bcc, 'Test User');
         $this->_logger->notice("Dev email redirected to " . $this->_config->email->bcc);
         try {
             $mail->send();
             $this->_logger->notice("Send Email: Dev email has been sent.");
         } catch (Exception $e) {
             $this->_logger->crit('Send Email: Error sending dev email.');
             //$this->_logger->err($e);     // causes an infinite loop since logger sends an email
         }
     }
 }
开发者ID:relyd,项目名称:aidstream,代码行数:31,代码来源:Email.php

示例13: format

 public function format(Zend_Mail $mail)
 {
     return sprintf("Subject: %s\nTo: %s\nText: %s\n\nHtml: %s", $mail->getSubject(), implode(', ', $mail->getRecipients()), $mail->getBodyText()->getContent(), $mail->getBodyHtml()->getContent());
 }
开发者ID:robo47,项目名称:robo47-components,代码行数:4,代码来源:Simple.php

示例14: sendMail

 /**
  * send an email
  *
  * @param Zend_Mail $mail
  * @param string $body
  * @param string $headers
  */
 public function sendMail(Zend_Mail $mail, $body, $headers)
 {
     $wasConnected = $this->_con !== null;
     // check if the connection is already there
     if (!$wasConnected) {
         $this->connect();
     } else {
         $this->rset();
     }
     // if already connected, reset connection
     try {
         $this->mail_from($mail->getFrom());
         foreach ($mail->getRecipients() as $recipient) {
             $this->rcpt_to($recipient);
         }
         $this->data($headers . "\r\n" . $body);
     } catch (Zend_Mail_Transport_Exception $e) {
         if (!$wasConnected) {
             $this->disconnect();
         }
         // remove connection if we made one
         throw $e;
     }
     if (!$wasConnected) {
         $this->disconnect();
     }
     // remove connection if we made one
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:35,代码来源:Smtp.php


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