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


PHP Email::setFrom方法代码示例

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


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

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

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

示例3: sendMessage

 private function sendMessage(NewsletterSentMessage $sent, LiveCart $application)
 {
     $config = $application->getConfig();
     $email = new Email($application);
     $email->setTemplate('newsletter/template');
     $email->set('subject', $this->subject->get());
     $email->set('htmlMessage', $this->html->get());
     $email->set('text', $this->text->get());
     $email->set('email', $this->text->get());
     $email->setFrom($config->get('NEWSLETTER_EMAIL') ? $config->get('NEWSLETTER_EMAIL') : $config->get('MAIN_EMAIL'), $config->get('STORE_NAME'));
     if ($user = $sent->user->get()) {
         $email->setTo($user->email->get(), $user->getName());
         $email->set('email', $user->email->get());
     } else {
         if ($subscriber = $sent->subscriber->get()) {
             $email->setTo($subscriber->email->get());
             $email->set('email', $subscriber->email->get());
         }
     }
     //$sent->time->set(new ARExpressionHandle('NOW()'));
     $sent->save();
     if ($this->status->get() == self::STATUS_NOT_SENT) {
         $this->status->set(self::STATUS_PARTIALLY_SENT);
         $this->time->set(new ARExpressionHandle('NOW()'));
         $this->save();
     }
     return $email->send();
 }
开发者ID:saiber,项目名称:www,代码行数:28,代码来源:NewsletterMessage.php

示例4: sendContactForm

 public function sendContactForm($data, $form)
 {
     $email = new Email();
     $email->setFrom('"mSupply Contact Form" <mSupply@mail.yakpost.org>')->setTo($this->SiteConfig()->ContactFormEmail)->setSubject('mSupply Message')->setTemplate('ContactFormEmail')->populateTemplate(new ArrayData(array('FullName' => $data['FullName'], 'Phone' => $data['Phone'], 'Email' => $data['Email'], 'Message' => $data['Message'])));
     $email->send();
     return $this->redirectback();
 }
开发者ID:tcaiger,项目名称:mSupplyNZ,代码行数:7,代码来源:ContactPage.php

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

示例6: SendNewsletterForm

 public function SendNewsletterForm($data, $form)
 {
     $email = new Email();
     $email->setFrom('"mSupply Newsletter Form" <mSupply@mail.yakpost.org>')->setTo($this->SiteConfig()->NewsletterFormEmail)->setSubject('mSupply Newsletter Request')->setTemplate('NewsletterSignUpEmail')->populateTemplate(new ArrayData(array('Email' => $data['Email'])));
     $email->send();
     return $this->redirectback();
 }
开发者ID:tcaiger,项目名称:mSupplyNZ,代码行数:7,代码来源:Page.php

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

示例8: emailCustomer

 /**
  * Sends an email receipt to customer
  *
  * @param  CustomerOrder $order
  * @return bool
  * @todo  Make subject configurable
  * @todo  Make tempalte more generic
  */
 public function emailCustomer($order)
 {
     $subject = 'Thank you for order on ' . date('Y-m-d' . '!') . ' from website';
     $from = SS_SEND_EMAIL_FROM;
     $to = $this->Email;
     $email = new Email();
     $email->setFrom($from)->setTo($to)->setSubject($subject)->setTemplate('CustomerEmail')->populateTemplate(new ArrayData(array('Customer' => $order->Customer(), 'CartItems' => $order->OrderItems(), 'ShippingCostTotal' => $order->shippingcost(), 'CartTotal' => $order->TotalAmount)));
     // $email->populateTemplate($order);
     $email->send();
 }
开发者ID:shoaibali,项目名称:silverstripe-shop-lite,代码行数:18,代码来源:Customers.php

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

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

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

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

示例13: send

 public function send()
 {
     if (!$this->buildValidator()->isValid()) {
         return new ActionRedirectResponse('contactForm', 'index');
     }
     $email = new Email($this->application);
     $email->setTemplate('contactForm/contactForm');
     $email->setFrom($this->request->get('email'), $this->request->get('name'));
     $email->setTo($this->config->get('NOTIFICATION_EMAIL'), $this->config->get('STORE_NAME'));
     $email->set('message', $this->request->get('msg'));
     $email->send();
     return new ActionRedirectResponse('contactForm', 'sent');
 }
开发者ID:saiber,项目名称:livecart,代码行数:13,代码来源:ContactFormController.php

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

示例15: doContact

 function doContact($data, $form)
 {
     //Send an email to the support
     $email = new Email();
     $email->setSubject("Contact Us form submitted");
     $email->setFrom($data['Email']);
     $email->setTo('support@attentionwizard.com');
     //$email->setTo('hemant.chakka@yahoo.com');
     $email->setTemplate('ContactUsEmail');
     $email->populateTemplate(array('Name' => $data['Name'], 'Email' => $data['Email'], 'Phone' => $data['Phone'], 'Topic' => $data['Topic'], 'Message' => $data['Message']));
     $email->send();
     $form->sessionMessage('Your email has been sent. Thank you for your message. Someone will respond back to you within 24-48 hours.', 'success');
     return $this->redirectBack();
 }
开发者ID:hemant-chakka,项目名称:awss,代码行数:14,代码来源:ContactUs.php


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