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


PHP Email::setBcc方法代码示例

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


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

示例1: run

 public function run($request)
 {
     $sent = 0;
     if (WorkflowInstance::get()->count()) {
         // Don't attempt the filter if no instances -- prevents a crash
         $active = WorkflowInstance::get()->innerJoin('WorkflowDefinition', '"DefinitionID" = "WorkflowDefinition"."ID"')->filter(array('WorkflowStatus' => array('Active', 'Paused'), 'RemindDays:GreaterThan' => '0'));
         $active->filter(array('RemindDays:GreaterThan' => '0'));
         if ($active) {
             foreach ($active as $instance) {
                 $edited = strtotime($instance->LastEdited);
                 $days = $instance->Definition()->RemindDays;
                 if ($edited + $days * 3600 * 24 > time()) {
                     continue;
                 }
                 $email = new Email();
                 $bcc = '';
                 $members = $instance->getAssignedMembers();
                 $target = $instance->getTarget();
                 if (!$members || !count($members)) {
                     continue;
                 }
                 $email->setSubject("Workflow Reminder: {$instance->Title}");
                 $email->setBcc(implode(', ', $members->column('Email')));
                 $email->setTemplate('WorkflowReminderEmail');
                 $email->populateTemplate(array('Instance' => $instance, 'Link' => $target instanceof SiteTree ? "admin/show/{$target->ID}" : ''));
                 $email->send();
                 $sent++;
                 $instance->LastEdited = time();
                 $instance->write();
             }
         }
     }
     echo "Sent {$sent} workflow reminder emails.\n";
 }
开发者ID:Neumes,项目名称:advancedworkflow,代码行数:34,代码来源:WorkflowReminderTask.php

示例2: run

 public function run($request)
 {
     $sent = 0;
     $filter = '"WorkflowStatus" IN (\'Active\', \'Paused\') AND "RemindDays" > 0';
     $join = 'INNER JOIN "WorkflowDefinition" ON "DefinitionID" = "WorkflowDefinition"."ID"';
     $active = DataObject::get('WorkflowInstance', $filter, null, $join);
     if ($active) {
         foreach ($active as $instance) {
             $edited = strtotime($instance->LastEdited);
             $days = $instance->Definition()->RemindDays;
             if ($edited + $days * 3600 * 24 > time()) {
                 continue;
             }
             $email = new Email();
             $bcc = '';
             $members = $instance->getAssignedMembers();
             $target = $instance->getTarget();
             if (!$members || !count($members)) {
                 continue;
             }
             $email->setSubject("Workflow Reminder: {$instance->Title}");
             $email->setBcc(implode(', ', $members->column('Email')));
             $email->setTemplate('WorkflowReminderEmail');
             $email->populateTemplate(array('Instance' => $instance, 'Link' => $target instanceof SiteTree ? "admin/show/{$target->ID}" : ''));
             $email->send();
             $sent++;
             $instance->LastEdited = time();
             $instance->write();
         }
     }
     echo "Sent {$sent} workflow reminder emails.\n";
 }
开发者ID:normann,项目名称:advancedworkflow,代码行数:32,代码来源:WorkflowReminderTask.php

示例3: doJobForm

 /**
  * Adds or modifies a job on the website.
  *
  * @param array $data
  * @param Form $form
  */
 public function doJobForm()
 {
     $data = $this->request->postVars();
     $form = new JobBoardForm($this);
     $form->loadDataFrom($data);
     $existed = false;
     if (!isset($data['JobID']) && !$data['JobID']) {
         $job = new Job();
     } else {
         $job = Job::get()->byId($data['JobID']);
         $existed = true;
         if ($job && !$job->canEdit()) {
             return $this->owner->httpError(404);
         } else {
             $job = new Job();
         }
     }
     $form->saveInto($job);
     $job->isActive = true;
     $job->write();
     Session::set('JobID', $job->ID);
     $member = Member::get()->filter(array('Email' => $data['Email']))->first();
     if (!$member) {
         $member = new Member();
         $member->Email = $SQL_email;
         $member->FirstName = isset($data['Company']) ? $data['Company'] : false;
         $password = Member::create_new_password();
         $member->Password = $password;
         $member->write();
         $member->addToGroupByCode('job-posters', _t('Jobboard.JOBPOSTERSGROUP', 'Job Posters'));
     }
     $member->logIn();
     $job->MemberID = $member->ID;
     $job->write();
     if (!$existed) {
         $email = new Email();
         $email->setSubject($data['EmailSubject']);
         $email->setFrom($data['EmailFrom']);
         $email->setTo($member->Email);
         // send the welcome email.
         $email->setTemplate('JobPosting');
         $email->populateTemplate(array('Member' => $member, 'Password' => isset($password) ? $password : false, 'FirstPost' => $password ? true : false, 'Holder' => $this, 'Job' => $job));
         if ($notify = $form->getController()->getJobNotifyAddress()) {
             $email->setBcc($notify);
         }
         $email->send();
     }
     return $this->redirect($data['BackURL']);
 }
开发者ID:helpfulrobot,项目名称:fullscreeninteractive-silverstripe-jobboard,代码行数:55,代码来源:JobBoardFormProcessor.php

示例4: sendEmail

 /**
  * Send a mail of the order to the client (and another to the admin).
  *
  * @param $template - the class name of the email you wish to send
  * @param $subject - subject of the email
  * @param $copyToAdmin - true by default, whether it should send a copy to the admin
  */
 public function sendEmail($template, $subject, $copyToAdmin = true)
 {
     $from = ShopConfig::config()->email_from ? ShopConfig::config()->email_from : Email::config()->admin_email;
     $to = $this->order->getLatestEmail();
     $checkoutpage = CheckoutPage::get()->first();
     $completemessage = $checkoutpage ? $checkoutpage->PurchaseComplete : "";
     $email = new Email();
     $email->setTemplate($template);
     $email->setFrom($from);
     $email->setTo($to);
     $email->setSubject($subject);
     if ($copyToAdmin) {
         $email->setBcc(Email::config()->admin_email);
     }
     $email->populateTemplate(array('PurchaseCompleteMessage' => $completemessage, 'Order' => $this->order, 'BaseURL' => Director::absoluteBaseURL()));
     return $email->send();
 }
开发者ID:helpfulrobot,项目名称:silvershop-core,代码行数:24,代码来源:OrderEmailNotifier.php

示例5: process

 public function process()
 {
     $sent = 0;
     $filter = array('WorkflowStatus' => array('Active', 'Paused'), 'Definition.RemindDays:GreaterThan' => 0);
     $active = WorkflowInstance::get()->filter($filter);
     foreach ($active as $instance) {
         $edited = strtotime($instance->LastEdited);
         $days = $instance->Definition()->RemindDays;
         if ($edited + $days * 3600 * 24 > time()) {
             continue;
         }
         $email = new Email();
         $bcc = '';
         $members = $instance->getAssignedMembers();
         $target = $instance->getTarget();
         if (!$members || !count($members)) {
             continue;
         }
         $email->setSubject("Workflow Reminder: {$instance->Title}");
         $email->setBcc(implode(', ', $members->column('Email')));
         $email->setTemplate('WorkflowReminderEmail');
         $email->populateTemplate(array('Instance' => $instance, 'Link' => $target instanceof SiteTree ? "admin/show/{$target->ID}" : ''));
         $email->send();
         $sent++;
         // add a comment to the workflow if possible
         $action = $instance->CurrentAction();
         $currentComment = $action->Comment;
         $action->Comment = sprintf(_t('AdvancedWorkflow.JOB_REMINDER_COMMENT', '%s: Reminder email sent\\n\\n'), date('Y-m-d H:i:s')) . $currentComment;
         try {
             $action->write();
         } catch (Exception $ex) {
             SS_Log::log($ex, SS_Log::WARN);
         }
         $instance->LastEdited = time();
         try {
             $instance->write();
         } catch (Exception $ex) {
             SS_Log::log($ex, SS_Log::WARN);
         }
     }
     $this->currentStep = 2;
     $this->isComplete = true;
     $nextDate = date('Y-m-d H:i:s', time() + $this->repeatInterval);
     $this->queuedJobService->queueJob(new WorkflowReminderJob($this->repeatInterval), $nextDate);
 }
开发者ID:Neumes,项目名称:advancedworkflow,代码行数:45,代码来源:WorkflowReminderJob.php

示例6: execute

 public function execute(WorkflowInstance $workflow)
 {
     $email = new Email();
     $members = $workflow->getAssignedMembers();
     $emails = '';
     if (!$members || !count($members)) {
         return;
     }
     foreach ($members as $member) {
         if ($member->Email) {
             $emails .= "{$member->Email}, ";
         }
     }
     $context = $this->getContextFields($workflow->getTarget());
     $member = $this->getMemberFields();
     $variables = array();
     foreach ($context as $field => $val) {
         $variables["\$Context.{$field}"] = $val;
     }
     foreach ($member as $field => $val) {
         $variables["\$Member.{$field}"] = $val;
     }
     $subject = str_replace(array_keys($variables), array_values($variables), $this->EmailSubject);
     if ($this->ListingTemplateID) {
         $item = $workflow->customise(array('Items' => $workflow->Actions(), 'Member' => Member::currentUser(), 'Context' => $workflow->getTarget()));
         $template = DataObject::get_by_id('ListingTemplate', $this->ListingTemplateID);
         $view = SSViewer::fromString($template->ItemTemplate);
         $body = $view->process($item);
     } else {
         $body = str_replace(array_keys($variables), array_values($variables), $this->EmailTemplate);
     }
     $email->setSubject($subject);
     $email->setFrom($this->EmailFrom);
     $email->setBcc(substr($emails, 0, -2));
     $email->setBody($body);
     $email->send();
     return true;
 }
开发者ID:rodneyway,项目名称:advancedworkflow,代码行数:38,代码来源:NotifyUsersWorkflowAction.php

示例7: addMember

 /**
  * Attempts to save either a registration or add member form submission
  * into a new member object, returning NULL on validation failure.
  *
  * @return Member|null
  */
 protected function addMember($form)
 {
     $member = new Member();
     $groupIds = $this->getSettableGroupIdsFrom($form);
     $form->saveInto($member);
     $member->ProfilePageID = $this->ID;
     $member->NeedsValidation = $this->EmailType == 'Validation';
     $member->NeedsApproval = $this->RequireApproval;
     try {
         $member->write();
     } catch (ValidationException $e) {
         $form->sessionMessage($e->getResult()->message(), 'bad');
         return;
     }
     // set after member is created otherwise the member object does not exist
     $member->Groups()->setByIDList($groupIds);
     // If we require admin approval, send an email to the admin and delay
     // sending an email to the member.
     if ($this->RequireApproval) {
         $groups = $this->ApprovalGroups();
         $emails = array();
         if ($groups) {
             foreach ($groups as $group) {
                 foreach ($group->Members() as $_member) {
                     if ($member->Email) {
                         $emails[] = $_member->Email;
                     }
                 }
             }
         }
         if ($emails) {
             $email = new Email();
             $config = SiteConfig::current_site_config();
             $approve = Controller::join_links(Director::baseURL(), 'member-approval', $member->ID, '?token=' . $member->ValidationKey);
             $email->setSubject("Registration Approval Requested for {$config->Title}");
             $email->setBcc(implode(',', array_unique($emails)));
             $email->setTemplate('MemberRequiresApprovalEmail');
             $email->populateTemplate(array('SiteConfig' => $config, 'Member' => $member, 'ApproveLink' => Director::absoluteURL($approve)));
             $email->send();
         }
     } elseif ($this->EmailType != 'None') {
         $email = new MemberConfirmationEmail($this, $member);
         $email->send();
     }
     $this->extend('onAddMember', $member);
     return $member;
 }
开发者ID:SilbinaryWolf,项目名称:silverstripe-memberprofiles,代码行数:53,代码来源:MemberProfilePage.php

示例8: SendEnquiryForm

 public function SendEnquiryForm($data, $form)
 {
     $From = $this->EmailFrom;
     $To = $this->EmailTo;
     $Subject = $this->EmailSubject;
     $email = new Email($From, $To, $Subject);
     $replyTo = $this->EnquiryFormFields()->filter(array('FieldType' => 'Email'))->First();
     if ($replyTo) {
         $postField = $this->keyGen($replyTo->FieldName, $replyTo->SortOrder);
         if (isset($data[$postField]) && Email::validEmailAddress($data[$postField])) {
             $email->replyTo($data[$postField]);
         }
     }
     if ($this->EmailBcc) {
         $email->setBcc($this->EmailBcc);
     }
     //abuse / tracking
     $email->addCustomHeader('X-Sender-IP', $_SERVER['REMOTE_ADDR']);
     //set template
     $email->setTemplate('EnquiryFormEmail');
     //populate template
     $templateData = $this->getTemplateData($data);
     $email->populateTemplate($templateData);
     //send mail
     $email->send();
     //return to submitted message
     if (Director::is_ajax()) {
         return $this->renderWith('EnquiryPageAjaxSuccess');
     }
     $this->redirect($this->Link('?success=1#thankyou'));
 }
开发者ID:axllent,项目名称:silverstripe-enquiry-page,代码行数:31,代码来源:EnquiryPage.php

示例9: onAfterWrite

 /**
  * standard SS Method
  * Sends an email to the member letting her / him know that the account has been approved.
  */
 function onAfterWrite()
 {
     if ($this->owner->isApprovedCorporateCustomer()) {
         if (!$this->owner->ApprovalEmailSent) {
             $config = SiteConfig::current_site_config();
             $ecommerceConfig = EcommerceDBConfig::current_ecommerce_db_config();
             $email = new Email();
             $email->setTo($this->owner->Email);
             $email->setSubject(_t("EcommerceCorporateAccount.ACCOUNTAPPROVEDFOR", "Account approved for ") . $config->Title);
             $email->setBcc(Order_Email::get_from_email());
             $email->setTemplate('EcommerceCorporateGroupApprovalEmail');
             $email->populateTemplate(array('SiteConfig' => $config, 'EcommerceConfig' => $ecommerceConfig, 'Member' => $this->owner));
             $email->send();
             $this->owner->ApprovalEmailSent = 1;
             $this->owner->write();
         }
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce-corporate-account,代码行数:22,代码来源:EcommerceCorporateGroupMemberDecorator.php

示例10: sendmail

 /**
  * Sent the e-mail.
  *
  * @param Array $data
  * @param Form $form
  */
 function sendmail($data, $form)
 {
     $email = Convert::raw2sql($data["EmailDownloadPageEmail"]);
     $obj = EmailDownloadPage_Registration::get()->filter(array("Email" => $email, "DownloadFileID" => $this->DownloadFileID))->first();
     if (!$obj) {
         $obj = new EmailDownloadPage_Registration();
         $obj->Email = $email;
         $obj->DownloadFileID = $this->DownloadFileID;
     } else {
         $obj->Used = false;
     }
     $obj->EmailDownloadPageID = $this->ID;
     $obj->write();
     $adminEmail = Email::getAdminEmail();
     if (!$adminEmail) {
         user_error("You need to set an admin email in order to use this page", E_USER_NOTICE);
     }
     $email = new Email($adminEmail, $data["EmailDownloadPageEmail"], $this->EmailSubject);
     if ($this->CopyOfAllEmailsToAdmin) {
         $email->setBcc($adminEmail);
     }
     $email->setTemplate($this->config()->get("email_template"));
     // You can call this multiple times or bundle everything into an array, including DataSetObjects
     $email->populateTemplate(new ArrayData(array("EmailSubject" => DBField::create_field('Varchar', $this->EmailSubject), "TitleOfFile" => DBField::create_field('Varchar', $this->TitleOfFile), "ValidUntil" => date('Y-M-d', strtotime("+" . $this->ValidityInDays * 86400 . " seconds")), "HasLink" => $this->LinkToThirdPartyDownload ? true : false, "HasFile" => $this->DownloadFileID ? true : false, "LinkToThirdPartyDownload" => $this->LinkToThirdPartyDownload, "File" => $this->DownloadFile(), "DownloadLink" => Director::absoluteURL($this->Link("dodownload/" . $obj->ID . "/" . $obj->Code . '/')), "FileLocation" => Director::absoluteURL($this->DownloadFile()->Link()))));
     $outcome = $email->send();
     Session::set($this->sessionVarNameForSending(), $outcome);
     $this->redirect($this->Link("thankyou/" . ($outcome ? "success" : "fail") . "/"));
     return array();
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-downloadtoemail,代码行数:35,代码来源:EmailDownloadPage.php


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