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


PHP Zend_Mail::addBcc方法代码示例

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


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

示例1: testOnlyText

 /**
  * Test case for a simple email text message with
  * multiple recipients.
  *
  */
 public function testOnlyText()
 {
     $mail = new Zend_Mail();
     $res = $mail->setBodyText('This is a test.');
     $mail->setFrom('testmail@example.com', 'test Mail User');
     $mail->setSubject('My Subject');
     $mail->addTo('recipient1@example.com');
     $mail->addTo('recipient2@example.com');
     $mail->addBcc('recipient1_bcc@example.com');
     $mail->addBcc('recipient2_bcc@example.com');
     $mail->addCc('recipient1_cc@example.com', 'Example no. 1 for cc');
     $mail->addCc('recipient2_cc@example.com', 'Example no. 2 for cc');
     $mock = new Zend_Mail_Transport_Mock();
     $mail->send($mock);
     $this->assertTrue($mock->called);
     $this->assertEquals('My Subject', $mock->subject);
     $this->assertEquals('testmail@example.com', $mock->from);
     $this->assertContains('recipient1@example.com', $mock->recipients);
     $this->assertContains('recipient2@example.com', $mock->recipients);
     $this->assertContains('recipient1_bcc@example.com', $mock->recipients);
     $this->assertContains('recipient2_bcc@example.com', $mock->recipients);
     $this->assertContains('recipient1_cc@example.com', $mock->recipients);
     $this->assertContains('recipient2_cc@example.com', $mock->recipients);
     $this->assertContains('This is a test.', $mock->body);
     $this->assertContains('Content-Transfer-Encoding: quoted-printable', $mock->header);
     $this->assertContains('Content-Type: text/plain', $mock->header);
     $this->assertContains('From: "test Mail User" <testmail@example.com>', $mock->header);
     $this->assertContains('Subject: My Subject', $mock->header);
     $this->assertContains('To: <recipient1@example.com>', $mock->header);
     $this->assertContains('Cc: "Example no. 1 for cc" <recipient1_cc@example.com>', $mock->header);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:36,代码来源:MailTest.php

示例2: askAction

 public function askAction()
 {
     $form = Model_Static_Loader::loadForm('forum');
     $forumModel = new Model_DbTable_Forum();
     if ($this->getRequest()->isPost() && $form->isValid($_POST)) {
         $question = $forumModel->createRow($form->getValues());
         if (preg_match('/^\\w+[\\w-\\.]*\\@\\w+((-\\w+)|(\\w*))\\.[a-z]{2,3}$/', $question->email) && ($question->category == 'Вопросы и запросы' || $question->category == 'Отзывы и предложения' || $question->category == 'Книга жалоб')) {
             $question->content = str_replace("\n", "<br/>\n", $question->content);
             $question->save();
             $users = new Zend_Config_Xml(APPLICATION_PATH . "/config/admins.xml");
             $users = $users->toArray();
             $mailer = new Zend_Mail("UTF-8");
             $mailer->setFrom($question->email, $question->author);
             $mailer->setSubject("форум");
             // wdaemon 2013-02-08  $mailer->setBodyHtml ( "Новый вопрос: " . $question->content, "utf8", "UTF-8");
             $mailer->setBodyHtml("Новый вопрос: " . $question->content);
             $mailer->addTo("info@alpha-hydro.com", "ALPHA-HYDRO info");
             $mailer->addBcc("fra@alpha-hydro.com", "Fedonov Roman A.");
             $mailer->addBcc("daemon007@mail.ru", "Быков Дмитрий Владимирович");
             foreach ($users as $user) {
                 if ($user["role"] == "administrator") {
                     $mailer->addTo($user['email'], $user['name']);
                 }
             }
             $mailer->send();
             $this->view->error = 0;
         } else {
             $this->view->error = 1;
         }
     } else {
         $this->_redirect($this->view->url(array("action" => "index")));
         return;
     }
 }
开发者ID:Alpha-Hydro,项目名称:alpha-hydro-antares,代码行数:34,代码来源:ForumController.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: GetEmailAddresses

 private function GetEmailAddresses($s_sql, Zend_Mail $email)
 {
     $a_send = null;
     if ($s_sql) {
         $result = $this->GetDataConnection()->query($s_sql);
         while ($o_row = $result->fetch()) {
             # first up, if this is a review item, get the title
             if (isset($o_row->title)) {
                 $this->s_review_item_title = $o_row->title;
             }
             # check if person in the previous subscriptions
             if (!is_array($this->a_emails) or !in_array($o_row->email, $this->a_emails)) {
                 #...add to email list
                 $a_send[] = $o_row->email;
                 # ... add also to list of people sent, to exclude from further emails
                 $this->a_emails[] = $o_row->email;
             }
         }
         $result->closeCursor();
         if (is_array($a_send)) {
             foreach ($a_send as $address) {
                 $email->addBcc($address);
             }
         }
     }
     return is_array($a_send);
 }
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:27,代码来源:subscription-manager.class.php

示例5: _setUpSending

 /** Set up sending to addresses
  * @access protected
  * @param array $to
  * @param array $cc
  * @param array $from
  * @param array $bcc
  */
 protected function _setUpSending($to, $cc, $from, $bcc)
 {
     if (is_array($to)) {
         foreach ($to as $addTo) {
             $this->_mail->addTo($addTo['email'], $addTo['name']);
         }
     } else {
         $this->_mail->addTo('info@finds.org.uk', 'The PAS head office');
     }
     if (is_array($cc)) {
         foreach ($cc as $addCc) {
             $this->_mail->addCc($addCc['email'], $addCc['name']);
         }
     }
     if (is_array($from)) {
         foreach ($from as $addFrom) {
             $this->_mail->setFrom($addFrom['email'], $addFrom['name']);
         }
     } else {
         $this->_mail->setFrom('info@finds.org.uk', 'The PAS head office');
     }
     if (is_array($bcc)) {
         foreach ($bcc as $addBcc) {
             $this->_mail->addBcc($addBcc['email'], $addBcc['name']);
         }
     }
 }
开发者ID:lesleyauk,项目名称:findsorguk,代码行数:34,代码来源:Mailer.php

示例6: send

 /**
  * Send an email.
  *
  * @param array $params Config object.
  *  Required keys: to, subject, message
  *  Optional keys: replyTo
  * @param array $viewParams Any values you wish to send to the HTML mail template
  * @param array $attachments
  * @return bool
  */
 public function send(array $params, array $viewParams = array(), $attachments = array())
 {
     $this->_validateParams($params);
     $mail = new Zend_Mail($this->getCharacterEncoding());
     $mail->setSubject($params['subject']);
     $mail->setBodyText($this->_getPlainBodyText($params));
     $mail->setFrom($this->getFromAddress(), $this->getFromName());
     $mail->addTo($params['to']);
     $viewParams['subject'] = $params['subject'];
     if ($this->getHtmlTemplate()) {
         $viewParams['message'] = isset($params['message']) ? $params['message'] : '';
         $viewParams['htmlMessage'] = isset($params['htmlMessage']) ? $params['htmlMessage'] : '';
         $mail->setBodyHtml($this->_renderView($viewParams));
     } elseif (isset($params['htmlMessage'])) {
         $mail->setBodyHtml($params['htmlMessage']);
     }
     if (!empty($params['replyTo'])) {
         $mail->setReplyTo($params['replyTo']);
     }
     if (!empty($params['cc'])) {
         $mail->addCc($params['cc']);
     }
     if (!empty($params['bcc'])) {
         $mail->addBcc($params['bcc']);
     }
     $this->addAttachments($attachments);
     $mimeParts = array_map(array($this, '_attachmentToMimePart'), $this->_attachments);
     array_walk($mimeParts, array($mail, 'addAttachment'));
     return $mail->send($this->getTransport());
 }
开发者ID:grrr-amsterdam,项目名称:garp3,代码行数:40,代码来源:Mailer.php

示例7: send

 /**
  * Send all messages in a queue
  *
  * @return Mage_Core_Model_Email_Queue
  */
 public function send()
 {
     /** @var $collection Mage_Core_Model_Resource_Email_Queue_Collection */
     $collection = Mage::getModel('core/email_queue')->getCollection()->addOnlyForSendingFilter()->setPageSize(self::MESSAGES_LIMIT_PER_CRON_RUN)->setCurPage(1)->load();
     ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
     ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
     /** @var $message Mage_Core_Model_Email_Queue */
     foreach ($collection as $message) {
         if ($message->getId()) {
             $parameters = new Varien_Object($message->getMessageParameters());
             if ($parameters->getReturnPathEmail() !== null) {
                 $mailTransport = new Zend_Mail_Transport_Sendmail("-f" . $parameters->getReturnPathEmail());
                 Zend_Mail::setDefaultTransport($mailTransport);
             }
             $mailer = new Zend_Mail('utf-8');
             foreach ($message->getRecipients() as $recipient) {
                 list($email, $name, $type) = $recipient;
                 switch ($type) {
                     case self::EMAIL_TYPE_BCC:
                         $mailer->addBcc($email, '=?utf-8?B?' . base64_encode($name) . '?=');
                         break;
                     case self::EMAIL_TYPE_TO:
                     case self::EMAIL_TYPE_CC:
                     default:
                         $mailer->addTo($email, '=?utf-8?B?' . base64_encode($name) . '?=');
                         break;
                 }
             }
             if ($parameters->getIsPlain()) {
                 $mailer->setBodyText($message->getMessageBody());
             } else {
                 $mailer->setBodyHTML($message->getMessageBody());
             }
             $mailer->setSubject('=?utf-8?B?' . base64_encode($parameters->getSubject()) . '?=');
             $mailer->setFrom($parameters->getFromEmail(), $parameters->getFromName());
             if ($parameters->getReplyTo() !== null) {
                 $mailer->setReplyTo($parameters->getReplyTo());
             }
             if ($parameters->getReturnTo() !== null) {
                 $mailer->setReturnPath($parameters->getReturnTo());
             }
             try {
                 //$mailer->send();
                 $mailer->send(Mage::helper('smtp')->getTransport());
                 unset($mailer);
                 $message->setProcessedAt(Varien_Date::formatDate(true));
                 $message->save();
             } catch (Exception $e) {
                 unset($mailer);
                 $oldDevMode = Mage::getIsDeveloperMode();
                 Mage::setIsDeveloperMode(true);
                 Mage::logException($e);
                 Mage::setIsDeveloperMode($oldDevMode);
                 return false;
             }
         }
     }
     return $this;
 }
开发者ID:TomOhme,项目名称:IP1-Webshop,代码行数:64,代码来源:Queue.php

示例8: SEND_SMTP_ZEND

 private function SEND_SMTP_ZEND()
 {
     try {
         loadLibrary("ZEND", "Zend_Mail");
         loadLibrary("ZEND", "Zend_Mail_Transport_Smtp");
         if (empty($this->MailText)) {
             $this->MailText = ">>";
         }
         if ($this->Account->Authentication == "No") {
             $config = array('port' => $this->Account->Port);
         } else {
             $config = array('auth' => 'login', 'username' => $this->Account->Username, 'password' => $this->Account->Password, 'port' => $this->Account->Port);
         }
         if (!empty($this->Account->SSL)) {
             $config['ssl'] = $this->Account->SSL == 1 ? 'SSL' : 'TLS';
         }
         $transport = new Zend_Mail_Transport_Smtp($this->Account->Host, $config);
         $mail = new Zend_Mail('UTF-8');
         $mail->setBodyText($this->MailText);
         $mail->setFrom($this->Account->Email, $this->Account->SenderName);
         if (strpos($this->Receiver, ",") !== false) {
             $emails = explode(",", $this->Receiver);
             $add = false;
             foreach ($emails as $mailrec) {
                 if (!empty($mailrec)) {
                     if (!$add) {
                         $add = true;
                         $mail->addTo($mailrec, $mailrec);
                     } else {
                         $mail->addBcc($mailrec, $mailrec);
                     }
                 }
             }
         } else {
             $mail->addTo($this->Receiver, $this->Receiver);
         }
         $mail->setSubject($this->Subject);
         $mail->setReplyTo($this->ReplyTo, $name = null);
         if ($this->Attachments != null) {
             foreach ($this->Attachments as $resId) {
                 $res = getResource($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->Account->Host . " send mail connection error: " . $e->getMessage(), "functions.global.inc.php", 0);
         }
         return 0;
     }
     return 1;
 }
开发者ID:elderxavier,项目名称:SII9-CREATIVE-STUDIO,代码行数:59,代码来源:objects.mail.inc.php

示例9: addBcc

 /**
  * Add one or more "BCC" email addresses.
  *
  * @param array|string $emails "BCC" email address or addresses
  * @return $this this mail instance
  */
 public function addBcc($emails)
 {
     parent::addBcc($emails);
     if (!is_array($emails)) {
         $emails = array($emails);
     }
     foreach ($emails as $email) {
         $_bcc[] = $email;
     }
     return $this;
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:17,代码来源:Mail.php

示例10: addBcc

 public function addBcc($email)
 {
     if (!is_array($email)) {
         $email = array($email);
     }
     foreach ($email as $recipient) {
         $this->bcc[] = $recipient;
         parent::addBcc($email);
     }
     return $this;
 }
开发者ID:platonicsolution,项目名称:local-server,代码行数:11,代码来源:Mail.php

示例11: sendMail

 /**
  * Função para envio de notificações via e-mail
  * @param string $title
  * @param array $destination
  * @param string $bodyMessage
  */
 protected function sendMail($title, $destination, $bodyMessage)
 {
     try {
         $mail = new Zend_Mail('UTF-8');
         $mail->setSubject($title);
         $mail->addBcc($destination);
         $mail->setBodyHtml($bodyMessage);
         $mail->send();
     } catch (Exception $e) {
         /* TODO Colocar Loogues aqui */
     }
 }
开发者ID:getJv,项目名称:ModuleTeste,代码行数:18,代码来源:Action.php

示例12: send

 /**
  * send email using smtp.gmail.com
  * @param array $options for sending mail
  * @return boolean
  */
 public static function send($options)
 {
     $body = '';
     $config = Zend_Registry::get('smtpConfig');
     if (isset($options['from']['email']) && $options['from']['email'] != '') {
         $fromAddress = $options['from']['email'];
     } else {
         $fromAddress = $config->fromAddress;
     }
     if ($config->isSendMails == true) {
         if (!empty($options['template']) && file_exists(APPLICATION_PATH . $options['template'])) {
             $template = new App_File(APPLICATION_PATH . $options['template']);
             $body = $template->contents;
             if (is_array($options['additional'])) {
                 foreach ($options['additional'] as $key => $value) {
                     $body = str_replace('{' . $key . '}', $value, $body);
                 }
             }
             if (is_array($options['data'])) {
                 foreach ($options['data'] as $key => $value) {
                     $body = str_replace('{' . $key . '}', $value, $body);
                 }
             }
         } else {
             $body = $options['body'];
         }
         $smtpConfig = array('ssl' => $config->ssl, 'port' => $config->port, 'auth' => $config->auth, 'username' => $config->username, 'password' => $config->password);
         $transport = new Zend_Mail_Transport_Smtp($config->host, $smtpConfig);
         $mail = new Zend_Mail('utf-8');
         $mail->setBodyHtml($body);
         $mail->setFrom($config->fromAddress, $config->fromName);
         $mail->setReplyTo($fromAddress, $config->fromName);
         //if (APPLICATION_ENV == 'production') {
         foreach ($options['to'] as $to) {
             $to['label'] = empty($to['label']) ? $to['email'] : $to['label'];
             $mail->addTo($to['email'], $to['label']);
         }
         //} else {
         //$mail->addTo($config->toAddress, $config->toName);
         //}
         if (isset($options['bcc']['email']) && !empty($options['bcc']['email'])) {
             $mail->addBcc($options['bcc']['email']);
         }
         $mail->setSubject($options['subject']);
         try {
             $mail->send($transport);
             return true;
         } catch (Zend_Exception $e) {
             return $e->getMessage();
         }
     }
     return false;
 }
开发者ID:uppaljs,项目名称:pakistan-vlmis-v2,代码行数:58,代码来源:Mail.php

示例13: sendMail

 /**
  * Sends contact email
  */
 private function sendMail($subject, $message, $fromName, $fromEmail)
 {
     $mail = new Zend_Mail('UTF-8');
     $mail->addTo('goreanski@gmail.com');
     $mail->addBcc('iaroslav.svet@gmail.com');
     $mail->setSubject($subject);
     $mail->setBodyText($message . PHP_EOL . 'Sender IP: ' . $_SERVER['REMOTE_ADDR']);
     $mail->setFrom('mailer@umkus.com', 'Unsee.cc');
     $mail->setReplyTo($fromEmail, $fromName);
     $mail->setDefaultTransport(new Zend_Mail_Transport_Sendmail());
     try {
         return $mail->send();
     } catch (Exception $e) {
     }
 }
开发者ID:HardSkript,项目名称:unsee.cc,代码行数:18,代码来源:ContactController.php

示例14: send

 public function send(Model_Comment $comment, Model_Post $post)
 {
     $mail = new Zend_Mail();
     $mail->setSubject('Comment posted on robkeplin.com');
     $message = $comment->name . ',
         <br><br>
         You\'ve successfully posted a cmment on www.robkeplin.com! 
         You can view it <a href="http://www.robkeplin.com/blog/view/' . urlencode($post->category->name) . '/' . urlencode($post->title) . '/">here</a>.<br><br>
         Thanks, <br />Rob<br /><a href="http://www.robkeplin.com">www.robkeplin.com</a>';
     $mail->setBodyHtml($message);
     $mail->setFrom('rkeplin@gmail.com', 'Rob Keplin');
     $mail->addTo($comment->email);
     $mail->addBcc('rkeplin@gmail.com');
     $this->_send($mail);
 }
开发者ID:kminkov,项目名称:Blog,代码行数:15,代码来源:Comment.php

示例15: sendEmail

 private function sendEmail($emailMessage, $recipients)
 {
     $mailerConfig = Zend_Registry::get("config")->mail;
     $transport = new Zend_Mail_Transport_Smtp($mailerConfig->host, $mailerConfig->smtpconfig->toArray());
     Zend_Mail::setDefaultTransport($transport);
     $email = new Zend_Mail('UTF-8');
     $email->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
     $email->addHeader('Content-type', 'text/html');
     $email->setFrom($emailMessage->getSenderAddress(), $emailMessage->getSenderName());
     $email->setSubject($emailMessage->getSubject());
     $email->setBodyHtml($emailMessage->getBody(), 'UTF-8');
     foreach ($recipients as $recipient) {
         $email->addBcc($recipient->getAddress(), $recipient->getName());
     }
     $email->send();
 }
开发者ID:Lazaro-Gallo,项目名称:psmn,代码行数:16,代码来源:ExecutionController.php


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