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


PHP Email::setSubject方法代码示例

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


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

 /**
  * Send comment notification to a given recipient
  *
  * @param Comment $comment
  * @param DataObject $parent Object with the {@see CommentNotifiable} extension applied
  * @param Member|string $recipient Either a member object or an email address to which notifications should be sent
  */
 public function notifyCommentRecipient($comment, $parent, $recipient)
 {
     $subject = $parent->notificationSubject($comment, $recipient);
     $sender = $parent->notificationSender($comment, $recipient);
     $template = $parent->notificationTemplate($comment, $recipient);
     // Validate email
     // Important in case of the owner being a default-admin or a username with no contact email
     $to = $recipient instanceof Member ? $recipient->Email : $recipient;
     if (!$this->isValidEmail($to)) {
         return;
     }
     // Prepare the email
     $email = new Email();
     $email->setSubject($subject);
     $email->setFrom($sender);
     $email->setTo($to);
     $email->setTemplate($template);
     $email->populateTemplate(array('Parent' => $parent, 'Comment' => $comment, 'Recipient' => $recipient));
     if ($recipient instanceof Member) {
         $email->populateTemplate(array('ApproveLink' => $comment->ApproveLink($recipient), 'HamLink' => $comment->HamLink($recipient), 'SpamLink' => $comment->SpamLink($recipient), 'DeleteLink' => $comment->DeleteLink($recipient)));
     }
     // Until invokeWithExtensions supports multiple arguments
     if (method_exists($this->owner, 'updateCommentNotification')) {
         $this->owner->updateCommentNotification($email, $comment, $recipient);
     }
     $this->owner->extend('updateCommentNotification', $email, $comment, $recipient);
     return $email->send();
 }
开发者ID:silverstripe,项目名称:comment-notifications,代码行数:35,代码来源:CommentNotifier.php

示例3: validateStep

 /**
  * This does not actually perform any validation, but just creates the
  * initial registration object.
  */
 public function validateStep($data, $form)
 {
     $form = $this->getForm();
     $datetime = $form->getController()->getDateTime();
     $confirmation = $datetime->Event()->RegEmailConfirm;
     $registration = $this->getForm()->getSession()->getRegistration();
     // If we require email validation for free registrations, then send
     // out the email and mark the registration. Otherwise immediately
     // mark it as valid.
     if ($confirmation) {
         $email = new Email();
         $config = SiteConfig::current_site_config();
         $registration->TimeID = $datetime->ID;
         $registration->Status = 'Unconfirmed';
         $registration->write();
         if (Member::currentUserID()) {
             $details = array('Name' => Member::currentUser()->getName(), 'Email' => Member::currentUser()->Email);
         } else {
             $details = $form->getSavedStepByClass('EventRegisterTicketsStep');
             $details = $details->loadData();
         }
         $link = Controller::join_links($this->getForm()->getController()->Link(), 'confirm', $registration->ID, '?token=' . $registration->Token);
         $regLink = Controller::join_links($datetime->Event()->Link(), 'registration', $registration->ID, '?token=' . $registration->Token);
         $email->setTo($details['Email']);
         $email->setSubject(sprintf('Confirm Registration For %s (%s)', $datetime->getTitle(), $config->Title));
         $email->setTemplate('EventRegistrationConfirmationEmail');
         $email->populateTemplate(array('Name' => $details['Name'], 'Registration' => $registration, 'RegLink' => $regLink, 'Title' => $datetime->getTitle(), 'SiteConfig' => $config, 'ConfirmLink' => Director::absoluteURL($link)));
         $email->send();
         Session::set("EventRegistration.{$registration->ID}.message", $datetime->Event()->EmailConfirmMessage);
     } else {
         $registration->Status = 'Valid';
         $registration->write();
     }
     return true;
 }
开发者ID:tardinha,项目名称:silverstripe-eventmanagement,代码行数:39,代码来源:EventRegisterFreeConfirmationStep.php

示例4: process

 public function process()
 {
     $config = SiteConfig::current_site_config();
     $datetime = $this->getDatetime();
     $emails = $this->emails;
     if (!count($emails)) {
         $this->isComplete = true;
         return;
     }
     $email = new Email();
     $email->setSubject(sprintf(_t('EventManagement.EVENTREMINDERSUBJECT', 'Event Reminder For %s (%s)'), $datetime->EventTitle(), $config->Title));
     $email->setTemplate('EventReminderEmail');
     $email->populateTemplate(array('SiteConfig' => $config, 'Datetime' => $datetime));
     foreach ($emails as $addr => $name) {
         $_email = clone $email;
         $_email->setTo($addr);
         $_email->populateTemplate(array('Name' => $name));
         $_email->send();
         unset($emails[$addr]);
         $this->emails = $emails;
         ++$this->currentStep;
     }
     if (!count($emails)) {
         $this->isComplete = true;
     }
 }
开发者ID:helpfulrobot,项目名称:ajshort-silverstripe-eventmanagement,代码行数:26,代码来源:EventReminderEmailJob.php

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

示例6: onAfterPostComment

 /**
  * Notify admin of new comment
  * 
  * @param Comment $comment
  */
 public function onAfterPostComment(Comment $comment)
 {
     // Determine recipient
     $recipient = CommentsNotifications::get_recipient($comment->getParent());
     if (empty($recipient)) {
         return;
     }
     // Check moderation status
     if (Config::inst()->get('CommentsNotifications', 'only_unmoderated') && $comment->Moderated) {
         return;
     }
     // Generate email
     $email = new Email();
     $email->setSubject(Config::inst()->get('CommentsNotifications', 'email_subject'));
     $email->setTo($recipient);
     $email->setTemplate(Config::inst()->get('CommentsNotifications', 'email_template'));
     $email->populateTemplate($comment);
     // Corretly set sender and from as per email convention
     $sender = Config::inst()->get('CommentsNotifications', 'email_sender');
     if (!empty($comment->Email)) {
         $email->setFrom($comment->Email);
         $email->addCustomHeader('Reply-To', $comment->Email);
     } else {
         $email->setFrom($sender);
     }
     $email->addCustomHeader('X-Sender', $sender);
     $email->addCustomHeader('Sender', $sender);
     $this->owner->extend('updateEmail', $email);
     // Send
     $email->send();
 }
开发者ID:helpfulrobot,项目名称:tractorcow-silverstripe-comments-notifications,代码行数:36,代码来源:CommentingControllerNotificationsExtension.php

示例7: form

 public function form(SS_HTTPRequest $request)
 {
     /*		
     		echo "<pre>";
     		echo print_r($request);
     		echo "<hr>";
     		echo print_r($_POST);
     		echo "</pre>";
     		echo $_SERVER['HTTP_REFERER'];
     */
     $data = $_POST;
     $email = new Email();
     $email->setTo('mail@nobrainer.dk');
     $email->setFrom($data['Email']);
     $email->setSubject("Contact Message from " . $data["Name"]);
     $messageBody = "\n\t\t\t<p><strong>Name:</strong> {$data['Name']}</p>\n\t\t\t<p><strong>Message:</strong> {$data['Message']}</p>\n\t\t";
     $email->setBody($messageBody);
     $email->send();
     /*		return array(
     			'Content' => '<p>Thank you for your feedback.</p>',
     			'Form' => ''
     		);
     */
     $this->redirect($_SERVER['HTTP_REFERER'] . "?status=success");
 }
开发者ID:helpfulrobot,项目名称:kendu-silverstripe-content-blocks,代码行数:25,代码来源:BlockController.php

示例8: setAnalysisEmail

 public function setAnalysisEmail(Analyse $analysis, $emailTo, $toName)
 {
     $content = new Content();
     $message = $content->getAnalysisContent($analysis, Session::getLoggedUser()->getFirstName());
     $email = new Email();
     $email->setSubject("Olá " . $toName . "! Você recebeu uma análise do Bureau Inteligencia!");
     $email->setMessage($message);
     return $email->send(null, $emailTo);
 }
开发者ID:raigons,项目名称:bureauinteligencia,代码行数:9,代码来源:EmailController.php

示例9: sendEmail

 function sendEmail($data, $form)
 {
     $email = new Email();
     $email->setTo($data['Email']);
     $email->setFrom($data['Email']);
     $email->setSubject('A subject with some umlauts: öäüß');
     $email->setBody('A body with some umlauts: öäüß');
     $email->send();
     echo "<p>email sent to " . $data['Email'] . "</p>";
 }
开发者ID:normann,项目名称:silverstripe-frameworktest,代码行数:10,代码来源:TestPage.php

示例10: testSetSubject

 /**
  * Tests the `setSubject` method.
  *
  * @return void
  * @access public
  */
 public function testSetSubject()
 {
     $this->assertIdentical($this->_object->getSubject(), '');
     // Make sure the setting was successful.
     $this->_object->setSubject('Test');
     $this->assertIdentical($this->_object->getSubject(), 'Test');
     // We only allow strings to be passed in.
     $this->expectException();
     $this->_object->setSubject(new Object());
 }
开发者ID:joebeeson,项目名称:mailer,代码行数:16,代码来源:Email.test.php

示例11: submit

 public function submit($data, $form)
 {
     $email = new Email();
     $email->setTo('colletwebpro@gmail.com');
     $email->setFrom($data['Email']);
     $email->setSubject("Contact Message from {$data["Name"]}");
     $messageBody = " \n            <p><strong>Name:</strong> {$data['Name']}</p> \n            <p><strong>Message:</strong> {$data['Message']}</p> \n        ";
     $email->setBody($messageBody);
     $email->send();
     return array('Content' => '<p>Thank you for your feedback.</p>', 'Form' => '');
 }
开发者ID:Geitz,项目名称:webdev_repo,代码行数:11,代码来源:ContactPage.php

示例12: sendEmail

 public function sendEmail($data, Form $form)
 {
     $email = new Email();
     $email->setTo('info@onboard.net.nz');
     $email->setFrom($data['Email']);
     $email->setSubject("Contact Message from {$data["Name"]}");
     $messageBody = "\n            <p><strong>Name:</strong> {$data['Name']}</p>\n            <p><strong>Email:</strong> {$data['Email']}</p>\n            <p><strong>Phone:</strong> {$data['Phone']}</p>\n            <p><strong>School:</strong> {$data['School']}</p>\n            <p><strong>Module:</strong> {$data['Module']}</p>\n            <p><strong>Message:</strong> {$data['Message']}</p>\n            ";
     $email->setBody($messageBody);
     $email->send();
     return array('Content' => '<p>Thank you for your feedback.</p>', 'Form' => '');
 }
开发者ID:dunatron,项目名称:onbaord-revamp,代码行数:11,代码来源:Page.php

示例13: sendPushNotification

 public function sendPushNotification(PushNotification $notification)
 {
     $email = new Email();
     $email->setFrom($this->getSetting('From'));
     $email->setSubject($this->getSetting('Subject'));
     $email->setBody($notification->Content);
     foreach ($notification->getRecipients() as $recipient) {
         $email->setTo($recipient->Email);
         $email->send();
     }
 }
开发者ID:silverstripe-australia,项目名称:silverstripe-push,代码行数:11,代码来源:EmailPushProvider.php

示例14: doContact

 public function doContact(array $data)
 {
     $email = new Email();
     $email->setTo(Email::getAdminEmail());
     $email->setFrom($data['Email']);
     $email->setSubject(_t('ContactForm.SUBJECT', 'ContactForm.SUBJECT') . $data['Name']);
     $email->setBody($data['Message']);
     //$email->set
     $email->send();
     $this->sessionMessage(_t('ContactForm.SUCCESS', 'ContactForm.SUCCESS'), 'good');
     $this->controller->redirectBack();
 }
开发者ID:andrelohmann,项目名称:roof-for-refugees.org,代码行数:12,代码来源:ContactForm.php

示例15: notifyOwner

 /**
  * @param int           $ownerID
  * @param array|SS_List $pages
  */
 protected function notifyOwner($ownerID, SS_List $pages)
 {
     $owner = self::$member_cache[$ownerID];
     $sender = Security::findAnAdministrator();
     $senderEmail = $sender->Email ? $sender->Email : Config::inst()->get("Email", "admin_email");
     $subject = _t("ContentReviewEmails.SUBJECT", "Page(s) are due for content review");
     $email = new Email();
     $email->setTo($owner->Email);
     $email->setFrom($senderEmail);
     $email->setTemplate("ContentReviewEmail");
     $email->setSubject($subject);
     $email->populateTemplate(array("Recipient" => $owner, "Sender" => $sender, "Pages" => $pages));
     $email->send();
 }
开发者ID:kinglozzer,项目名称:silverstripe-contentreview,代码行数:18,代码来源:ContentReviewEmails.php


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