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


PHP Swift_Message::setCc方法代码示例

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


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

示例1: transformMessage

 /**
  * Creates a swift message from a ParsedMessage, handles defaults
  *
  * @param ParsedMessage $parsedMessage
  *
  * @return \Swift_Message
  */
 protected function transformMessage(ParsedMessage $parsedMessage)
 {
     $message = new \Swift_Message();
     if ($from = $parsedMessage->getFrom()) {
         $message->setFrom($from);
     }
     // handle to with defaults
     if ($to = $parsedMessage->getTo()) {
         $message->setTo($to);
     }
     // handle cc with defaults
     if ($cc = $parsedMessage->getCc()) {
         $message->setCc($cc);
     }
     // handle bcc with defaults
     if ($bcc = $parsedMessage->getBcc()) {
         $message->setBcc($bcc);
     }
     // handle reply to with defaults
     if ($replyTo = $parsedMessage->getReplyTo()) {
         $message->setReplyTo($replyTo);
     }
     // handle subject with default
     if ($subject = $parsedMessage->getSubject()) {
         $message->setSubject($subject);
     }
     // handle body, no default values here
     $message->setBody($parsedMessage->getMessageText());
     if ($parsedMessage->getMessageHtml()) {
         $message->addPart($parsedMessage->getMessageHtml(), 'text/html');
     }
     return $message;
 }
开发者ID:sgomez,项目名称:SystemMailBundle,代码行数:40,代码来源:SwiftMailer.php

示例2: _mapToSwift

 protected function _mapToSwift(SendGrid\Email $mail)
 {
     $message = new \Swift_Message($mail->getSubject());
     /*
      * Since we're sending transactional email, we want the message to go to one person at a time, rather
      * than a bulk send on one message. In order to do this, we'll have to send the list of recipients through the headers
      * but Swift still requires a 'to' address. So we'll falsify it with the from address, as it will be 
      * ignored anyway.
      */
     $message->setTo($mail->to);
     $message->setFrom($mail->getFrom(true));
     $message->setCc($mail->getCcs());
     $message->setBcc($mail->getBccs());
     if ($mail->getHtml()) {
         $message->setBody($mail->getHtml(), 'text/html');
         if ($mail->getText()) {
             $message->addPart($mail->getText(), 'text/plain');
         }
     } else {
         $message->setBody($mail->getText(), 'text/plain');
     }
     if ($replyto = $mail->getReplyTo()) {
         $message->setReplyTo($replyto);
     }
     $attachments = $mail->getAttachments();
     //add any attachments that were added
     if ($attachments) {
         foreach ($attachments as $attachment) {
             $message->attach(\Swift_Attachment::fromPath($attachment['file']));
         }
     }
     $message_headers = $message->getHeaders();
     $message_headers->addTextHeader("x-smtpapi", $mail->smtpapi->jsonString());
     return $message;
 }
开发者ID:alpha1,项目名称:sendgrid-wordpress,代码行数:35,代码来源:class-sendgrid-smtp.php

示例3: _mapToSwift

 protected function _mapToSwift(Mail $mail)
 {
     $message = new \Swift_Message($mail->getSubject());
     /*
      * Since we're sending transactional email, we want the message to go to one person at a time, rather
      * than a bulk send on one message. In order to do this, we'll have to send the list of recipients through the headers
      * but Swift still requires a 'to' address. So we'll falsify it with the from address, as it will be 
      * ignored anyway.
      */
     $message->setTo($mail->getFrom());
     $message->setFrom($mail->getFrom(true));
     $message->setCc($mail->getCcs());
     $message->setBcc($mail->getBccs());
     if ($mail->getHtml()) {
         $message->setBody($mail->getHtml(), 'text/html');
         if ($mail->getText()) {
             $message->addPart($mail->getText(), 'text/plain');
         }
     } else {
         $message->setBody($mail->getText(), 'text/plain');
     }
     if ($replyto = $mail->getReplyTo()) {
         $message->setReplyTo($replyto);
     }
     // determine whether or not we can use SMTP recipients (non header based)
     if ($mail->useHeaders()) {
         //send header based email
         $message->setTo($mail->getFrom());
         //here we'll add the recipients list to the headers
         $headers = $mail->getHeaders();
         $headers['to'] = $mail->getTos();
         $mail->setHeaders($headers);
     } else {
         $recipients = array();
         foreach ($mail->getTos() as $recipient) {
             if (preg_match("/(.*)<(.*)>/", $recipient, $results)) {
                 $recipients[trim($results[2])] = trim($results[1]);
             } else {
                 $recipients[] = $recipient;
             }
         }
         $message->setTo($recipients);
     }
     $attachments = $mail->getAttachments();
     //add any attachments that were added
     if ($attachments) {
         foreach ($attachments as $attachment) {
             $message->attach(\Swift_Attachment::fromPath($attachment['file']));
         }
     }
     //add all the headers
     $headers = $message->getHeaders();
     $headers->addTextHeader('X-SMTPAPI', $mail->getHeadersJson());
     return $message;
 }
开发者ID:vzoom96,项目名称:Hackathon-Projects,代码行数:55,代码来源:Smtp.php

示例4: send

    /**
     * Send mail.
     *
     * @param array  $from               From address array('john@doe.com' => 'John Doe').
     * @param array  $to                 To address 'receiver@domain.org' or array('other@domain.org' => 'A name').
     * @param string $subject            Subject.
     * @param string $body               Content body.
     * @param array  $contentType        Content type for body, default 'text/plain'.
     * @param array  $cc                 CC to, array('receiver@domain.org', 'other@domain.org' => 'A name').
     * @param array  $bcc                BCC to, array('receiver@domain.org', 'other@domain.org' => 'A name').
     * @param array  $replyTo            Reply to, array('receiver@domain.org', 'other@domain.org' => 'A name').
     * @param mixed  $altBody            Alternate body.
     * @param string $altBodyContentType Alternate content type default 'text/html'.
     * @param array  $header             Associative array of headers array('header1' => 'value1', 'header2' => 'value2').
     * @param array  &$failedRecipients  Array.
     * @param string $charset            Null means leave at default.
     * @param array  $attachments        Array of files.
     *
     * @return integet
     */
    function send(array $from, array $to, $subject, $body, $contentType = 'text/plain', array $cc=null, array $bcc=null, array $replyTo=null, $altBody = null, $altBodyContentType = 'text/html', array $header = array(), &$failedRecipients = array(), $charset=null, array $attachments=array())
    {
        $message = new Swift_Message($subject, $body, $contentType);
        $message->setTo($to);
        $message->setFrom($from);
        if ($attachments) {
            foreach ($attachments as $attachment) {
                $message->attach(Swift_Attachment::fromPath($attachment));
            }
        }
        
        if ($cc) {
            $message->setCc($cc);
        }

        if ($bcc) {
            $message->setBcc($bcc);
        }

        if ($replyTo) {
            $message->setReplyTo($replyTo);
        }

        if ($charset) {
            $message->setCharset($charset);
        }

        if ($altBody) {
            $message->addPart($altBody, $altBodyContentType);
        }

        if ($headers) {
            $headers = $message->getHeaders();
            foreach ($headers as $key => $value) {
                $headers->addTextHeader($key, $value);
            }
        }

        if ($this->serviceManager['swiftmailer.preferences.sendmethod'] == 'normal') {
            return $this->mailer->send($message, $failedRecipients);
        } else if ($this->serviceManager['swiftmailer.preferences.sendmethod'] == 'single_recipient') {
            return $this->mailer->sendBatch($message, $failedRecipients);
        }
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:64,代码来源:Mailer.php

示例5: processEmail

    /**
     * Prepare the email message.
     */
    public function processEmail()
    {
        $this->count = 1;
        $mail = new Swift_Message();
        $mail->setContentType('text/plain');
        $mail->setCharset('utf-8');
        if ($this->getOption('use_complete_template', true)) {
            $mail->setBody(sprintf(<<<EOF
------
%s - %s
------
%s
------
EOF
, $this->options['name'], $this->options['email'], $this->options['message']));
        } else {
            $mail->setBody($this->options['message']);
        }
        $mail->setSender(array(sfPlop::get('sf_plop_messaging_from_email') => sfPlop::get('sf_plop_messaging_from_name')));
        $mail->setFrom(array($this->options['email'] => $this->options['name']));
        if ($this->getOption('copy')) {
            $mail->setCc(array($this->options['email'] => $this->options['name']));
            $this->count++;
        }
        if (is_integer($this->getOption('receiver'))) {
            $receiver = sfGuardUserProfilePeer::retrieveByPK($this->getOption('receiver'));
            if ($receiver) {
                $mail->setTo(array($receiver->getEmail() => $receiver->getFullName()));
            } else {
                $mail->setTo(array(sfPlop::get('sf_plop_messaging_to_email') => sfPlop::get('sf_plop_messaging_to_name')));
            }
        } else {
            $mail->setTo(array(sfPlop::get('sf_plop_messaging_to_email') => sfPlop::get('sf_plop_messaging_to_name')));
        }
        if ($this->getOption('subject')) {
            $mail->setSubject($this->getOption('subject'));
        } else {
            $mail->setSubject(sfPlop::get('sf_plop_messaging_subject'));
        }
        $this->mail = $mail;
    }
开发者ID:noreiller,项目名称:sfPlopPlugin,代码行数:44,代码来源:sfPlopMessaging.class.php

示例6: testWritingMessageToByteStreamTwiceUsingAFileAttachment

 public function testWritingMessageToByteStreamTwiceUsingAFileAttachment()
 {
     $message = new Swift_Message();
     $message->setSubject('test subject');
     $message->setTo('user@domain.tld');
     $message->setCc('other@domain.tld');
     $message->setFrom('user@domain.tld');
     $attachment = Swift_Attachment::fromPath($this->_attFile);
     $message->attach($attachment);
     $message->setBody('HTML part', 'text/html');
     $id = $message->getId();
     $date = preg_quote(date('r', $message->getDate()), '~');
     $boundary = $message->getBoundary();
     $streamA = new Swift_ByteStream_ArrayByteStream();
     $streamB = new Swift_ByteStream_ArrayByteStream();
     $pattern = '~^' . 'Message-ID: <' . $id . '>' . "\r\n" . 'Date: ' . $date . "\r\n" . 'Subject: test subject' . "\r\n" . 'From: user@domain.tld' . "\r\n" . 'To: user@domain.tld' . "\r\n" . 'Cc: other@domain.tld' . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'Content-Type: multipart/mixed;' . "\r\n" . ' boundary="' . $boundary . '"' . "\r\n" . "\r\n\r\n" . '--' . $boundary . "\r\n" . 'Content-Type: text/html; charset=utf-8' . "\r\n" . 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . "\r\n" . 'HTML part' . "\r\n\r\n" . '--' . $boundary . "\r\n" . 'Content-Type: ' . $this->_attFileType . '; name=' . $this->_attFileName . "\r\n" . 'Content-Transfer-Encoding: base64' . "\r\n" . 'Content-Disposition: attachment; filename=' . $this->_attFileName . "\r\n" . "\r\n" . preg_quote(base64_encode(file_get_contents($this->_attFile)), '~') . "\r\n\r\n" . '--' . $boundary . '--' . "\r\n" . '$~D';
     $message->toByteStream($streamA);
     $message->toByteStream($streamB);
     $this->assertPatternInStream($pattern, $streamA);
     $this->assertPatternInStream($pattern, $streamB);
 }
开发者ID:dosh93,项目名称:shop,代码行数:21,代码来源:Bug38Test.php

示例7: _createMessage

 /**
  * @param string $template
  * @param array  $data
  *
  * @throws \InvalidArgumentException
  * @return \Swift_Mime_Message
  */
 protected function _createMessage($template, &$data)
 {
     //	Pull out all the message data
     $_to = array_get($data, 'to');
     $_from = array_get($data, 'from');
     $_replyTo = array_get($data, 'reply_to');
     $_cc = array_get($data, 'cc');
     $_bcc = array_get($data, 'bcc');
     $_subject = array_get($data, 'subject');
     //	Get body template...
     if (false === ($_html = @file_get_contents($template))) {
         //	Something went awry
         throw new \InvalidArgumentException('Error reading contents of template "' . $template . '".');
     }
     //	And the message...
     $_message = new \Swift_Message();
     if (!empty($_subject)) {
         $_message->setSubject($_subject);
     }
     if (!empty($_to)) {
         $_message->setTo($_to);
     }
     if (!empty($_from)) {
         $_message->setFrom($_from);
     }
     if (!empty($_cc)) {
         $_message->setCc($_cc);
     }
     if (!empty($_bcc)) {
         $_message->setBcc($_bcc);
     }
     if (!empty($_replyTo)) {
         $_message->setReplyTo($_replyTo);
     }
     //	process generic macros.
     $_message->setBody($this->replaceMacros($data, $_html), 'text/html');
     return $_message;
 }
开发者ID:rajeshpillai,项目名称:dfe-common,代码行数:45,代码来源:MailTemplateService.php

示例8: sendCc

 /**
  * Add CC e-mail addresses
  *
  * Friendly name portions (e.g. Admin <admin@example.com>) are allowed. The
  * method takes an unlimited number of recipient addresses.
  */
 public function sendCc()
 {
     $this->objMessage->setCc($this->compileRecipients(func_get_args()));
 }
开发者ID:juergen83,项目名称:contao,代码行数:10,代码来源:Email.php

示例9: send

 /**
  * Send the mail
  * @param string|array $to - mail reciver, can be also as array('john@doe.com' => 'John Doe')
  * @param enum(html|text) $format - format of letter (html or text)
  * @return boolean
  */
 public function send($to, $format = 'text')
 {
     //include_once LIBPATH
     rad_mailtemplate::setCurrentItem($this);
     $o = rad_rsmarty::getSmartyObject();
     if ($this->getVars()) {
         foreach ($this->getVars() as $key => $value) {
             $o->assign($key, $value);
         }
     }
     if (!is_file(MAILTEMPLATESPATH . $this->getTemplateName())) {
         throw new rad_exception('File "' . MAILTEMPLATESPATH . $this->getTemplateName() . '" not found!');
     }
     $o->fetch(MAILTEMPLATESPATH . $this->getTemplateName());
     $o->clearAllAssign();
     if (empty($this->_blocks[$format])) {
         throw new rad_exception('Format "' . $format . '" is not declared in file: "' . MAILTEMPLATESPATH . $this->getTemplateName() . '"');
     }
     if (!empty($this->_mailer)) {
         $this->_mailer->setSubject($this->_blocks[$format]['subject']);
         if (!empty($this->_blocks[$format]['Cc'])) {
             $this->_mailer->setCc($this->_blocks[$format]['Cc']);
         }
         if (!empty($this->_blocks[$format]['Bcc'])) {
             $this->_mailer->setBcc($this->_blocks[$format]['Bcc']);
         }
         if (!empty($this->_blocks[$format]['headers'])) {
             $headers = rad_mailtemplate::parseHeader($this->_blocks[$format]['headers']);
             if (!empty($headers)) {
                 foreach ($headers as $headerName => $headerValue) {
                     switch (strtolower($headerName)) {
                         case 'x-priority':
                             $this->_mailer->setPriority((int) $headerValue);
                             break;
                         default:
                             $this->_mailer->getHeaders()->addTextHeader($headerName, $headerValue);
                             break;
                     }
                 }
             }
         }
         if (!empty($this->_blocks[$format]['body'])) {
             $this->_mailer->setBody($this->_blocks[$format]['body'], $format == 'text' ? 'text/plain' : 'text/html');
         }
         if (!empty($this->_blocks[$format]['from'])) {
             $from = explode("\n", str_replace("\r", '', $this->_blocks[$format]['from']));
             if (count($from)) {
                 foreach ($from as $fromString) {
                     $fromItem = explode('<', $fromString);
                     if (count($fromItem) > 1) {
                         $fromName = trim($fromItem[0]);
                         $fromEmail = trim(str_replace('>', '', $fromItem[1]));
                     } else {
                         $fromName = trim($fromItem[0]);
                         $fromEmail = trim($fromItem[0]);
                     }
                     $this->_mailer->setFrom(array($fromEmail => $fromName));
                     $this->_mailer->setReturnPath($fromEmail);
                 }
             }
         }
         if (!empty($this->_blocks[$format]['transport'])) {
             $transport = explode("\n", str_replace("\r", '', $this->_blocks[$format]['transport']));
             if (!empty($transport)) {
                 $transportParams = array();
                 foreach ($transport as $transportKey => $transportString) {
                     $transportString = trim($transportString);
                     if (!empty($transportString)) {
                         $transportItem = explode(':', $transportString);
                         if (count($transportItem) > 1) {
                             $transportItemKey = trim($transportItem[0]);
                             unset($transportItem[0]);
                             $transportItemValue = trim(implode(':', $transportItem));
                             $transportParams[$transportItemKey] = $transportItemValue;
                         }
                     }
                 }
             }
             if (empty($transportParams['type'])) {
                 throw new rad_exception('Error in mailtemplate "' . $this->getTemplateName() . '" at transport block: type of the transport required!');
             }
             switch (strtolower($transportParams['type'])) {
                 case 'smtp':
                     if (empty($transportParams['host']) or empty($transportParams['port']) or empty($transportParams['user']) or !isset($transportParams['password'])) {
                         throw new rad_exception('Error in mailtemplate "' . $this->getTemplateName() . '" at transport block: Not enouph actual params!');
                     }
                     $this->_transportInstance = Swift_SmtpTransport::newInstance($transportParams['host'], $transportParams['port'])->setUsername($transportParams['user'])->setPassword($transportParams['password']);
                     if (!empty($transportParams['security'])) {
                         $this->_transportInstance->setEncryption($transportParams['security']);
                     }
                     break;
                 case 'mail':
                     $this->_transportInstance = Swift_MailTransport::newInstance();
                     break;
//.........这里部分代码省略.........
开发者ID:ValenokPC,项目名称:tabernacms,代码行数:101,代码来源:class.mailtemplate_item.php

示例10: buildCc

 /**
  * Creating the message Carbon Copy (cc).
  *
  * @return MailInterface The current instance
  */
 protected function buildCc() : MailInterface
 {
     null === $this->get('ccAddresses') ? null : $this->swiftMessage->setCc((array) $this->get('ccAddresses'));
     return $this;
 }
开发者ID:ucsdmath,项目名称:mail,代码行数:10,代码来源:MailExtendedOperationsTrait.php

示例11: testSendFailed

 public function testSendFailed()
 {
     $serviceManager = new CM_Service_Manager();
     $logger = $this->mockObject('CM_Log_Logger');
     $serviceManager->registerInstance('logger', $logger);
     $transport = $this->mockInterface('Swift_Transport')->newInstance();
     $transport->mockMethod('isStarted')->set(true);
     $message = new Swift_Message('foo', 'content');
     $message->setFrom('foobar@example.com', 'Foobar');
     $message->setTo('foo@example.com');
     $message->setCc('bar@example.com', 'bar');
     $client = new CM_Mail_Mailer($transport);
     $client->setServiceManager($serviceManager);
     $sendMethod = $transport->mockMethod('send')->set(0);
     $errorMethod = $logger->mockMethod('error')->set(function ($message, CM_Log_Context $context = null) {
         $this->assertSame('Failed to send email', $message);
         $this->assertSame(['message' => ['subject' => 'foo', 'from' => ['foobar@example.com' => 'Foobar'], 'to' => ['foo@example.com' => null], 'cc' => ['bar@example.com' => 'bar'], 'bcc' => null], 'failedRecipients' => ['foo@example.com', 'bar@example.com']], $context->getExtra());
     });
     $failedRecipients = ['foo@example.com', 'bar@example.com'];
     $client->send($message, $failedRecipients);
     /** @var CM_Exception_Invalid $exception */
     $this->assertSame(1, $sendMethod->getCallCount());
     $this->assertSame(1, $errorMethod->getCallCount());
 }
开发者ID:cargomedia,项目名称:cm,代码行数:24,代码来源:MailerTest.php

示例12: send_email


//.........这里部分代码省略.........
        $body .= "--" . $separator . $EOL;
        $body .= "Content-Type: text/html; charset=\"iso-8859-1\"" . $EOL;
        $body .= "Content-Transfer-Encoding: 8bit" . $EOL . $EOL;
        $body .= $message . $EOL;
        // attachment
        $attachment = chunk_split(base64_encode($attachments_arr[0]['data']));
        $body .= "--" . $separator . $EOL;
        $body .= "Content-Type: application/octet-stream; name=\"" . $attachments_arr[0]['filename'] . "\"" . $EOL;
        $body .= "Content-Transfer-Encoding: base64" . $EOL;
        $body .= "Content-Disposition: attachment" . $EOL . $EOL;
        $body .= $attachment . $EOL;
        $body .= "--" . $separator . "--";
        $message = $body;
    } else {
        $headers .= "Content-Type: text/html {$EOL}";
        $headers .= "MIME-Version: 1.0 {$EOL}";
        //$headers.="charset=utf-8 $EOL";
        $headers .= "Content-Transfer-Encoding: 8bit {$EOL}";
        $headers .= "X-Mailer: Shopnix - eCommerce Solution {$EOL}";
    }
    // Setup parameters
    $status = 'SUCCESS';
    if (EMAILER_HOST == 'LOCAL') {
        $emailer_host = $_SERVER['SERVER_NAME'];
        $resp = mail($to, $subject, $message, $headers);
        // SEND EMAIL
        if ($resp) {
            $status = 'SUCCESS';
        } else {
            $status = 'FAILED';
        }
    } elseif (EMAILER_HOST == 'REMOTE') {
        $headers .= "From:{$from} \nCC: {$cc} \nBcc: {$bcc}";
        $from = urlencode($from);
        $to = urlencode($to);
        $cc = urlencode($cc);
        $bcc = urlencode($bcc);
        $subject = urlencode($subject);
        $url = "http://mitnix.in/snix/modules/utils/emailer.php?to={$to}&from={$from}&cc={$cc}&bcc={$bcc}&sub={$subject}";
        $resp = curl_post($url, $message);
        // SEND EMAIL
        $emailer_host = 'cloudnix.com';
    } elseif (EMAILER_HOST == 'MANDRILL') {
        // Setup data
        $sw_from = convert_email($from);
        $sw_to = convert_email($to);
        $text = strip_tags($plain_message);
        $html = $plain_message;
        $emailer_host = 'Mandrill';
        // Setup connection info
        $transport = Swift_SmtpTransport::newInstance('smtp.mandrillapp.com', 587);
        $transport->setUsername(SMTP_USERNAME);
        $transport->setPassword(SMTP_PASSWORD);
        $swift = Swift_Mailer::newInstance($transport);
        // Setup Data object
        $message = new Swift_Message($subject);
        $message->setFrom($sw_from);
        $message->setBody($html, 'text/html');
        $message->setTo($sw_to);
        $message->addPart($text, 'text/plain');
        if ($bcc) {
            $sw_bcc = convert_email($bcc);
            //echo "<pre>Setting BCC[$bcc] to [".print_r($sw_bcc,true)."]</pre>";
            $message->setBcc($sw_bcc);
        }
        if ($cc) {
            $sw_cc = convert_email($cc);
            //echo "<pre>Setting CC[$cc] to [".print_r($sw_cc,true)."]</pre>";
            $message->setCc($sw_cc);
        }
        if ($attachments_arr) {
            // Create the attachment with your data
            $attachment = Swift_Attachment::newInstance($attachments_arr[0]['data'], $attachments_arr[0]['filename'], "application/{$field_type}");
            // Attach it to the message
            $message->attach($attachment);
        }
        // Send mail
        if ($recipients = $swift->send($message, $failures)) {
            $resp = true;
            $status = 'SUCCESS';
        } else {
            LOG_MSG('ERROR', "send_email(MANDRILL): Error sending email=[" . print_r($failures, true) . "]");
            $resp = false;
            $status = 'FAILED';
        }
    } else {
        LOG_MSG("INFO", "EMAILER_HOST is OFF. Not sending email");
        $status = 'NOT SENT';
        $resp = true;
    }
    if (defined('SHOP_ID') && $from != 'security@shopnix.in') {
        // Don't store security emails
        $email_resp = db_emails_insert($from, $to, $cc, $bcc, $plain_subject, $plain_message, $status, $headers, $emailer_host);
        if ($email_resp['STATUS'] != 'OK') {
            LOG_MSG('ERROR', "send_email(): Error while inserting in EMails talble from=[{$from}] to=[{$to}]");
        }
    }
    LOG_MSG("INFO", "\n\t******************************EMAIL START [{$status}]******************************\n\tTO: [{$to}]\n\t{$headers}\n\tSUBJECT:[{$subject}]\n\t{$plain_message}\n\t******************************EMAIL END******************************");
    return $resp;
}
开发者ID:teju,项目名称:Android,代码行数:101,代码来源:utils.php

示例13: setCc

 /**
  * {@inheritdoc}
  *
  * @return $this|self
  */
 public function setCc($addresses, $name = null) : self
 {
     $this->message->setCc($addresses, $name);
     return $this;
 }
开发者ID:cawaphp,项目名称:email,代码行数:10,代码来源:Message.php

示例14: send_email

function send_email($to, $from, $cc = '', $bcc = '', $subject, $message)
{
    LOG_MSG('INFO', "send_email(): START EMAILER_HOST=[" . EMAILER_HOST . "] to=[{$to}] from=[{$from}] cc=[{$cc}] bcc=[{$bcc}] subject=[{$subject}]");
    // Defaults
    if (!$bcc) {
        $bcc = EMAIL_BCC;
    }
    // Add footer to the message
    ob_start();
    include HTML_DIR . '/emails/email_footer.html';
    $message .= ob_get_contents();
    ob_get_clean();
    $headers = "Content-Type: text/html\r\n";
    //."MIME-Version: 1.0\r\n"
    //."charset=utf-8\r\n"
    //."Content-Transfer-Encoding: 8bit\r\n"
    //."X-Mailer: Shopnix - eCommerce Solution\r\n";
    // To store subject whithout appending with SHOP_NAME
    $plain_subject = $subject;
    $subject = "[" . SHOP_NAME . "] {$subject}";
    // Setup parameters
    $status = 'SUCCESS';
    if (EMAILER_HOST == 'LOCAL') {
        $emailer_host = $_SERVER['SERVER_NAME'];
        $headers .= "From: {$from}\r\n";
        $headers .= "CC: {$cc}\r\n";
        $headers .= "Bcc: {$bcc}\r\n";
        $resp = mail($to, $subject, $message, $headers);
        // SEND EMAIL
        if ($resp) {
            $status = 'SUCCESS';
        } else {
            $status = 'FAILED';
        }
    } elseif (EMAILER_HOST == 'REMOTE') {
        $headers .= "From:{$from} \nCC: {$cc} \nBcc: {$bcc}";
        $from = urlencode($from);
        $to = urlencode($to);
        $cc = urlencode($cc);
        $bcc = urlencode($bcc);
        $subject = urlencode($subject);
        $url = "";
        $resp = curl_post($url, $message);
        // SEND EMAIL
        $emailer_host = 'cloudnix.com';
    } elseif (EMAILER_HOST == 'MANDRILL') {
        // Setup data
        $sw_from = convert_email($from);
        $sw_to = convert_email($to);
        $text = strip_tags($message);
        $html = $message;
        $emailer_host = 'Mandrill';
        // Setup connection info
        $transport = Swift_SmtpTransport::newInstance('smtp.mandrillapp.com1', 587);
        $transport->setUsername(SMTP_USERNAME);
        $transport->setPassword(SMTP_PASSWORD);
        $swift = Swift_Mailer::newInstance($transport);
        // Setup Data object
        $sw_message = new Swift_Message($subject);
        $sw_message->setFrom($sw_from);
        $sw_message->setBody($html, 'text/html');
        $sw_message->setTo($sw_to);
        $sw_message->addPart($text, 'text/plain');
        if ($bcc) {
            $sw_bcc = convert_email($bcc);
            //echo "<pre>Setting BCC[$bcc] to [".print_r($sw_bcc,true)."]</pre>";
            $sw_message->setBcc($sw_bcc);
        }
        if ($cc) {
            $sw_cc = convert_email($cc);
            //echo "<pre>Setting CC[$cc] to [".print_r($sw_cc,true)."]</pre>";
            $sw_message->setCc($sw_cc);
        }
        // Send mail
        if ($recipients = $swift->send($sw_message, $failures)) {
            $resp = true;
            $status = 'SUCCESS';
        } else {
            LOG_MSG('ERROR', "send_email(MANDRILL): Error sending email=[" . print_r($failures, true) . "]");
            $resp = false;
            $status = 'FAILED';
        }
    } else {
        LOG_MSG("INFO", "EMAILER_HOST is OFF. Not sending email");
        $status = 'NOT SENT';
        $resp = true;
    }
    $email_resp = db_emails_insert($from, $to, $cc, $bcc, $plain_subject, $message, $status, $headers, EMAILER_HOST);
    if ($email_resp['STATUS'] != 'OK') {
        LOG_MSG('ERROR', "send_email(): Error while inserting in EMails talble from=[{$from}] to=[{$to}]");
    }
    LOG_MSG("INFO", "\n\t******************************EMAIL START[{$status}]******************************\n\tTO: [{$to}]\n\t{$headers}\n\tSUBJECT:[{$subject}]\n\t{$message}\n\t******************************EMAIL END******************************");
    return $resp;
}
开发者ID:abkiran,项目名称:reddy,代码行数:94,代码来源:Common.php

示例15: getSwiftMessage

 /**
  * Returns a Swift_Message instance that can be sent
  * 
  * @return \Swift_Message
  */
 public function getSwiftMessage()
 {
     $message = new \Swift_Message();
     $message->setDate($this->getDate()->getTimestamp());
     $message->setFrom($this->getFrom());
     $message->setReplyTo($this->getReplyTo());
     $message->setReturnPath($this->getReturnPath());
     $message->setTo($this->getTo());
     $message->setCc($this->getCc());
     $message->setBcc($this->getBcc());
     $message->setSubject($this->getSubject());
     $message->setBody($this->getBody());
     return $message;
 }
开发者ID:tweedegolf,项目名称:swiftmailer-logger-bundle,代码行数:19,代码来源:LoggedMessage.php


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