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


PHP Zend_Mail::addCc方法代码示例

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


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

示例1:

 function __construct($template)
 {
     $this->_mailer = new Zend_Mail('koi8-r');
     $this->_view = new Zend_View();
     $this->_template = $template;
     $this->_view->setScriptPath(APPLICATION_PATH . '/views/scripts/email');
     $config = Bootstrap::get('config');
     $this->_mailer->addCc($config["mail"]["kadavr"]);
     $this->_mailer->addCc($config["mail"]["cc"]);
 }
开发者ID:smalyshev,项目名称:chgk-teams,代码行数:10,代码来源:Mail.php

示例2: 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

示例3: send

 /**
  * load the template and send the message
  *
  * @param string $recipient
  * @param array $from
  * @param string $subject
  * @param string $template
  * @param array $data
  * @param string $cc
  * @return bool
  */
 public function send($recipient, $from = array(), $subject, $message, $cc = false)
 {
     $config = Zend_Registry::get('config');
     $this->_view->addScriptPath($config->filepath->emailTemplates);
     $this->_view->emailBody = $message;
     $this->_mail->setBodyHtml($this->_view->render('template.phtml'));
     $this->_mail->setFrom($from[0], $from[1]);
     $this->_mail->addTo($recipient);
     if ($cc) {
         $this->_mail->addCc($cc);
     }
     $this->_mail->setSubject($subject);
     return $this->_mail->send($this->_transport);
 }
开发者ID:laiello,项目名称:digitalus-cms,代码行数:25,代码来源:Mail.php

示例4: 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

示例5: contatoAction

 public function contatoAction()
 {
     if ($this->_request->isPost()) {
         $html = new Zend_View();
         $html->setScriptPath(APPLICATION_PATH . '/modules/default/layouts/scripts/');
         $title = 'Contato | Instag';
         $to = 'eduardo@inndeia.com';
         $cc = 'renato@inndeia.com';
         $html->assign('title', $title);
         $html->assign('nome', $this->_request->getPost('nome'));
         $html->assign('email', $this->_request->getPost('email'));
         $html->assign('assunto', $this->_request->getPost('assunto'));
         $html->assign('mensagem', $this->_request->getPost('mensagem'));
         $mail = new Zend_Mail('utf-8');
         $bodyText = $html->render('contato.phtml');
         $config = array('ssl' => 'tls', 'port' => 587, 'auth' => 'login', 'username' => 'nao-responder@instag.com.br', 'password' => 'Inndeia123');
         $transport = new Zend_Mail_Transport_Smtp('127.0.0.1', $config);
         $mail->addTo($to);
         $mail->addCc($cc);
         $mail->setSubject($title);
         $mail->setFrom($this->_request->getPost('email'), $this->_request->getPost('name'));
         $mail->setBodyHtml($bodyText);
         $send = $mail->send($transport);
         if ($send) {
             $this->_helper->flashMessenger->addMessage('Sua mensagem foi enviada com sucesso, em breve entraremos em contato.');
         } else {
             $this->_helper->flashMessenger->addMessage('Falha no envio, tente novamente!');
         }
         $this->_redirect('/index');
     }
 }
开发者ID:pccnf,项目名称:proj_instag,代码行数:31,代码来源:IndexController.php

示例6: sendMail

 public static function sendMail($content)
 {
     $front = Zend_Controller_Front::getInstance();
     $email = new Base_Php_Overloader($front->getParam("bootstrap")->getOption('smtp'));
     $smtp = $email->domain;
     $username = $email->username;
     $password = $email->password;
     $port = $email->port;
     $config = new Zend_Mail_Transport_Smtp($smtp, array('auth' => 'login', 'username' => $username, 'password' => $password, 'ssl' => "ssl", 'port' => $port));
     Zend_Mail::setDefaultTransport($config);
     $mail = new Zend_Mail('UTF-8');
     $mail->setBodyHtml($content['body']);
     // Email body
     $mail->setFrom($content['sender'], $content['nameSender']);
     // Sender (Email, Name)
     $mail->addTo(isset($content['recipient']) ? $content['recipient'] : '', isset($content['nameRecipient']) ? $content['nameRecipient'] : '');
     // Recipient (Email, Name)
     $mail->addCc($content['sender'], $content['nameSender']);
     // CC to // Reply to Sender
     $mail->setSubject($content['subject']);
     // Subject Email
     try {
         $flag = $mail->send($config);
     } catch (Zend_Exception $e) {
         Base_Helper_Log::getInstance()->log(PHP_EOL . date('H:i:s :::: ') . ' [MAIL] ' . $e->getMessage());
         $flag = false;
     }
     if ($flag) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:HuyTran0424,项目名称:noeavrsev345452dfgdfgsg,代码行数:33,代码来源:Mail.php

示例7: _sendEmail

 protected function _sendEmail($history)
 {
     ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
     ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
     $mail = new Zend_Mail('utf-8');
     $mail->addTo($history->getEmail());
     $mail->setBodyHTML($history->getBody());
     $mail->setSubject('=?utf-8?B?' . base64_encode($history->getSubject()) . '?=');
     $senderName = Mage::getStoreConfig(self::NAME_XML_PATH, $history->getStoreId());
     //Mage::getStoreConfig('trans_email/ident_general/name');
     $senderEmail = Mage::getStoreConfig(self::EMAIL_XML_PATH, $history->getStoreId());
     //Mage::getStoreConfig('trans_email/ident_general/email');
     $cc = Mage::getStoreConfig(self::CC_XML_PATH, $history->getStoreId());
     $mail->addCc($cc);
     $mail->setFrom($senderEmail, $senderName);
     try {
         if ((string) Mage::getConfig()->getNode('modules/Aschroder_SMTPPro/active') == 'true') {
             $transport = Mage::helper('smtppro')->getTransport();
             $mail->send($transport);
         } else {
             $mail->send();
         }
     } catch (Exception $e) {
         Mage::logException($e);
         return false;
     }
     return true;
 }
开发者ID:ankita-parashar,项目名称:magento,代码行数:28,代码来源:Amasty_Acart_Model_Schedule.php

示例8: sendAction

 public function sendAction()
 {
     // 返回值数组
     $result = array();
     // 请求参数
     // $request = $this->getRequest()->getParams();
     $now = date('Y-m-d H:i:s');
     /* $data = array(
                'subject'       => $request['subject'],
                'to'            => $request['to'],
                'to_name'       => $request['to_name'],
                'cc'            => $request['cc'],
                'cc_name'       => $request['cc_name'],
                'content'       => $request['content'],
                'attachment'    => $request['attachment']
        ); */
     $data = array('subject' => 'test', 'to' => '14706931@qq.com', 'to_name' => '新大陆', 'cc' => 'leonli188@126.com', 'cc_name' => 'leon', 'content' => 'test123测试', 'charset' => 'utf-8', 'attachment' => null);
     echo '<pre>';
     print_r($data);
     $mailConfig = new Zend_Config_Ini(CONFIGS_PATH . '/application.ini', 'mail');
     $from = $mailConfig->smtp->from;
     $fromname = $mailConfig->smtp->fromname;
     $transport = new Zend_Mail_Transport_Smtp($mailConfig->smtp->server, $mailConfig->smtp->params->toArray());
     $mail = new Zend_Mail();
     $mail->setSubject($data['subject']);
     $mail->setBodyText($data['content'], $data['charset']);
     $mail->setFrom($from, $fromname);
     $mail->addTo($data['to'], $data['to_name']);
     $mail->addCc($data['cc'], $data['cc_name']);
     $mail->addAttachment('MailController.php');
     $mail->createAttachment(file_get_contents('E:\\sina.png'), 'image/png', Zend_Mime::DISPOSITION_INLINE, Zend_Mime::ENCODING_BASE64, 'sina.png');
     print_r($mail->send($transport));
     //echo Zend_Json::encode($result);
     exit;
 }
开发者ID:xindalu,项目名称:evolve,代码行数:35,代码来源:MailController.php

示例9: _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

示例10: addCc

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

示例11: addCc

 public function addCc($email, $name = '')
 {
     if (Kwf_Registry::get('config')->debug->sendAllMailsTo) {
         if ($name) {
             $this->addHeader('X-Real-Cc', $name . " <" . $email . ">");
         } else {
             $this->addHeader('X-Real-Cc', $email);
         }
     } else {
         parent::addCc($email, $name);
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:koala-framework,代码行数:13,代码来源:Mail.php

示例12: handle

 /**
  * @param string $fromTitle
  * @param string $fromMail
  * @param string $toEmail
  * @param array $recipientCC
  * @param array $recipientBCC
  * @param string $subject
  * @param string $body
  * @param string $attachments
  * @param string $smtpHost
  * @param string $smtpPort
  * @param string $serverLogin
  * @param string $serverPassword
  * @param string $charCode
  * @param boolean $isHtml
  * @return type
  */
 public function handle($fromTitle, $fromMail, $toEmail, array $recipientCC, array $recipientBCC, $subject, $body, $attachments, $smtpHost = null, $smtpPort = null, $serverLogin = null, $serverPassword = null, $charCode = 'UTF-8', $isHtml = false, $replyto = null)
 {
     if ($smtpHost) {
         $params = array('name' => 'ZendMailHandler', 'port' => $smtpPort);
         if ($serverLogin) {
             $params['auth'] = 'login';
             $params['username'] = $serverLogin;
             $params['password'] = $serverPassword;
         }
         $transport = new Zend_Mail_Transport_Smtp($smtpHost, $params);
     } else {
         $transport = new Zend_Mail_Transport_Sendmail(array('name' => 'ZendMailHandler'));
     }
     $mail = new Zend_Mail($charCode);
     $mail->setFrom($fromMail, $fromTitle)->addTo($toEmail)->setSubject($subject);
     if (!empty($recipientCC)) {
         $mail->addCc($recipientCC);
     }
     if (!empty($recipientBCC)) {
         $mail->addBcc($recipientBCC);
     }
     //$mail->setReturnPath($replyto);
     if (!empty($replyto)) {
         $mail->setReplyTo($replyto);
     }
     if ($isHtml) {
         $mail->setBodyHtml($body);
     } else {
         $mail->setBodyText($body);
     }
     if (is_object($attachments) && $attachments->areAttachments()) {
         $mail->setType(Zend_Mime::MULTIPART_RELATED);
         $attachments->handle($mail);
     }
     if ($mail->send($transport)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:knatorski,项目名称:SMS,代码行数:57,代码来源:ZendMail.php

示例13: BuildPostedDataObject

 /**
  * @return void
  * @desc Re-build from data posted by this control the data object this control is editing
  */
 function BuildPostedDataObject()
 {
     $o_email = new Zend_Mail('UTF-8');
     if (isset($_POST['to']) and key_exists($_POST['to'], $this->a_addresses_md5)) {
         $o_email->addTo($this->a_addresses_md5[$_POST['to']]);
     }
     if (isset($_POST['from'])) {
         $o_email->setFrom($_POST['from'], (isset($_POST['fromName']) and $_POST['fromName']) ? $_POST['fromName'] : $_POST['from']);
     }
     if (isset($_POST['subject']) and $_POST['subject']) {
         $o_email->setSubject($_POST['subject']);
     } else {
         $o_email->setSubject($this->GetSettings()->GetSiteName() . ' contact form');
     }
     $body = isset($_POST['body']) ? $_POST['body'] : '';
     if (isset($_POST['reply'])) {
         $body .= "\n\n(The sender of this message has asked for a reply.)";
     }
     $o_email->setBodyText($body);
     if (isset($_POST['cc'])) {
         $o_email->addCc($_POST['from']);
     }
     $this->SetDataObject($o_email);
 }
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:28,代码来源:contact-form.class.php

示例14: sendMail

 /**
  * Method to send mail
  * @param array $options ($message, $to, $subject)
  */
 public function sendMail($options)
 {
     //$config = array('ssl' => 'tls', 'port' => 587, 'auth' => 'login', 'username' => 'myiartz@myiartz.com', 'password' => 'iruyeqij');
     //$smtpConnection = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
     //Message Gears
     $config = array('ssl' => 'tls', 'port' => 2525, 'auth' => 'login', 'username' => '66917973', 'password' => '85cd337542324ca6addd1e821349dbf2');
     $smtpConnection = new Zend_Mail_Transport_Smtp('smtp.messagegears.net', $config);
     $html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><html><head></head><body style=\"background: #e2e2e2;\"><div style=\"width:600px !important; font-family:Arial; margin:auto; border:1px solid #e2e2e2; padding:15px; background: #fff; \" width=\"600\" ><table width='600' style='background: #fff; width:600px;'><tr><td valign='top'>" . $options['message'] . "</td></tr></table><br><br><br></div><br><br><br></body></html>";
     $html = wordwrap($html, 50);
     $html = preg_replace('/\\x00+/', '', $html);
     $mail = new Zend_Mail('utf-8');
     //$mail->setBodyText(strip_tags($options['message']));
     $mail->setBodyHTML($html);
     $mail->setFrom($this->_fromEmail, $this->_fromName);
     $mail->addTo($options['to']);
     if (isset($options['Bcc'])) {
         $mail->addBcc($options['Bcc']);
     }
     if (isset($options['cc'])) {
         $mail->addCc($options['cc']);
     }
     $mail->setSubject($options['subject']);
     $mail->send($smtpConnection);
 }
开发者ID:tolya199178,项目名称:swift,代码行数:28,代码来源:Email.php

示例15: testHeaderEncoding

 /**
  * Check if Header Fields are encoded correctly and if
  * header injection is prevented.
  */
 public function testHeaderEncoding()
 {
     $mail = new Zend_Mail();
     $mail->setBodyText('My Nice Test Text');
     // try header injection:
     $mail->addTo("testmail@example.com\nCc:foobar@example.com");
     $mail->addHeader('X-MyTest', "Test\nCc:foobar2@example.com", true);
     // try special Chars in Header Fields:
     $mail->setFrom('mymail@example.com', 'äüößÄÖÜ');
     $mail->addTo('testmail2@example.com', 'äüößÄÖÜ');
     $mail->addCc('testmail3@example.com', 'äüößÄÖÜ');
     $mail->setSubject('äüößÄÖÜ');
     $mail->addHeader('X-MyTest', 'Test-äüößÄÖÜ', true);
     $mock = new Zend_Mail_Transport_Mock();
     $mail->send($mock);
     $this->assertTrue($mock->called);
     $this->assertContains('From: =?iso8859-1?Q?"=E4=FC=F6=DF=C4=D6=DC"?=', $mock->header);
     $this->assertNotContains("\nCc:foobar@example.com", $mock->header);
     $this->assertContains('=?iso8859-1?Q?"=E4=FC=F6=DF=C4=D6=DC"=20?=<testmail2@example.com>', $mock->header);
     $this->assertContains('Cc: =?iso8859-1?Q?"=E4=FC=F6=DF=C4=D6=DC"=20?=<testmail3@example.com>', $mock->header);
     $this->assertContains('Subject: =?iso8859-1?Q?=E4=FC=F6=DF=C4=D6=DC?=', $mock->header);
     $this->assertContains('X-MyTest:', $mock->header);
     $this->assertNotContains("\nCc:foobar2@example.com", $mock->header);
     $this->assertContains('=?iso8859-1?Q?Test-=E4=FC=F6=DF=C4=D6=DC?=', $mock->header);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:29,代码来源:MailTest.php


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