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


PHP Email::config方法代码示例

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


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

示例1: output

 public function output()
 {
     // TODO: Refactor into a content-type option
     if (\Director::is_ajax()) {
         return $this->friendlyErrorMessage;
     } else {
         // TODO: Refactor this into CMS
         if (class_exists('ErrorPage')) {
             $errorFilePath = \ErrorPage::get_filepath_for_errorcode($this->statusCode, class_exists('Translatable') ? \Translatable::get_current_locale() : null);
             if (file_exists($errorFilePath)) {
                 $content = file_get_contents($errorFilePath);
                 if (!headers_sent()) {
                     header('Content-Type: text/html');
                 }
                 // $BaseURL is left dynamic in error-###.html, so that multi-domain sites don't get broken
                 return str_replace('$BaseURL', \Director::absoluteBaseURL(), $content);
             }
         }
         $renderer = \Debug::create_debug_view();
         $output = $renderer->renderHeader();
         $output .= $renderer->renderInfo("Website Error", $this->friendlyErrorMessage, $this->friendlyErrorDetail);
         if (\Email::config()->admin_email) {
             $mailto = \Email::obfuscate(\Email::config()->admin_email);
             $output .= $renderer->renderParagraph('Contact an administrator: ' . $mailto . '');
         }
         $output .= $renderer->renderFooter();
         return $output;
     }
 }
开发者ID:vinstah,项目名称:silverstripe-framework,代码行数:29,代码来源:DebugViewFriendlyErrorFormatter.php

示例2: onBeforeWrite

 public function onBeforeWrite()
 {
     if ($this->owner->BaseClass == "Discussion" && $this->owner->ID == 0) {
         $discussion = Discussion::get()->byID($this->owner->ParentID);
         $discussion_author = $discussion->Author();
         $holder = $discussion->Parent();
         $author = Member::get()->byID($this->owner->AuthorID);
         // Get our default email from address
         if (DiscussionHolder::config()->send_emails_from) {
             $from = DiscussionHolder::config()->send_email_from;
         } else {
             $from = Email::config()->admin_email;
         }
         // Vars for the emails
         $vars = array("Title" => $discussion->Title, "Author" => $author, "Comment" => $this->owner->Comment, 'Link' => Controller::join_links($holder->Link("view"), $discussion->ID, "#comments-holder"));
         // Send email to discussion owner
         if ($discussion_author && $discussion_author->Email && $discussion_author->RecieveCommentEmails && $discussion_author->ID != $this->owner->AuthorID) {
             $subject = _t("Discussions.NewCreatedReplySubject", "{Nickname} replied to your discussion", null, array("Nickname" => $author->Nickname));
             $email = new Email($from, $discussion_author->Email, $subject);
             $email->setTemplate('NewCreatedReplyEmail');
             $email->populateTemplate($vars);
             $email->send();
         }
         // Send to anyone who liked this, if they want notifications
         foreach ($discussion->LikedBy() as $liked) {
             if ($liked->RecieveLikedReplyEmails && $liked->Email && $liked->ID != $author->ID) {
                 $subject = _t("Discussions.NewLikedReplySubject", "{Nickname} replied to your liked discussion", null, array("Nickname" => $author->Nickname));
                 $email = new Email($from, $liked->Email, $subject);
                 $email->setTemplate('NewLikedReplyEmail');
                 $email->populateTemplate($vars);
                 $email->send();
             }
         }
     }
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-discussions,代码行数:35,代码来源:DiscussionsComment.php

示例3: get_from_email

 /**
  * returns the standard from email address (e.g. the shop admin email address)
  * @return String
  */
 public static function get_from_email()
 {
     $ecommerceConfig = EcommerceDBConfig::current_ecommerce_db_config();
     if ($ecommerceConfig && $ecommerceConfig->ReceiptEmail) {
         return $ecommerceConfig->ReceiptEmail;
     } else {
         return Email::config()->admin_email;
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:13,代码来源:Order_Email.php

示例4: setupMailer

 /**
  * this is mainly a test harness
  * @return [type] [description]
  */
 public function setupMailer()
 {
     Requirements::clear();
     $this->parseVariables(true);
     if (empty($this->from)) {
         $this->from = Email::config()->admin_email;
     }
     $headers = $this->customHeaders;
     if (project()) {
         $headers['X-SilverStripeSite'] = project();
     }
     $to = $this->to;
     $from = $this->from;
     $subject = $this->subject;
     if ($sendAllTo = $this->config()->send_all_emails_to) {
         $subject .= " [addressed to {$to}";
         $to = $sendAllTo;
         if ($this->cc) {
             $subject .= ", cc to {$this->cc}";
         }
         if ($this->bcc) {
             $subject .= ", bcc to {$this->bcc}";
         }
         $subject .= ']';
         unset($headers['Cc']);
         unset($headers['Bcc']);
     } else {
         if ($this->cc) {
             $headers['Cc'] = $this->cc;
         }
         if ($this->bcc) {
             $headers['Bcc'] = $this->bcc;
         }
     }
     if ($ccAllTo = $this->config()->cc_all_emails_to) {
         if (!empty($headers['Cc']) && trim($headers['Cc'])) {
             $headers['Cc'] .= ', ' . $ccAllTo;
         } else {
             $headers['Cc'] = $ccAllTo;
         }
     }
     if ($bccAllTo = $this->config()->bcc_all_emails_to) {
         if (!empty($headers['Bcc']) && trim($headers['Bcc'])) {
             $headers['Bcc'] .= ', ' . $bccAllTo;
         } else {
             $headers['Bcc'] = $bccAllTo;
         }
     }
     if ($sendAllfrom = $this->config()->send_all_emails_from) {
         if ($from) {
             $subject .= " [from {$from}]";
         }
         $from = $sendAllfrom;
     }
     Requirements::restore();
     return self::mailer()->setupMailer($to, $from, $subject, $this->attachments, $headers);
 }
开发者ID:helpfulrobot,项目名称:azt3k-abc-silverstripe-mailer,代码行数:61,代码来源:SMTPEmail.php

示例5: notificationRecipients

 /**
  * Return the list of members or emails to send comment notifications to
  *
  * @param Comment $comment
  * @return array|Traversable
  */
 public function notificationRecipients($comment)
 {
     // Override this in your extending class to declare recipients
     $list = array();
     if ($adminEmail = Email::config()->admin_email) {
         $list[] = $adminEmail;
     }
     $this->owner->extend('updateNotificationRecipients', $list, $comment);
     return $list;
 }
开发者ID:silverstripe,项目名称:comment-notifications,代码行数:16,代码来源:CommentNotifiable.php

示例6: sendUpdateNotification

 public function sendUpdateNotification()
 {
     $name = $data['FirstName'] . " " . $data['Surname'];
     $body = "{$name} has updated their details via the website. Here is the new information:<br/>";
     foreach ($this->member->getAllFields() as $key => $field) {
         if (isset($data[$key])) {
             $body .= "<br/>{$key}: " . $data[$key];
             $body .= $field != $data[$key] ? "  <span style='color:red;'>(changed)</span>" : "";
         }
     }
     $email = new Email(Email::config()->admin_email, Email::config()->admin_email, "Member details update: {$name}", $body);
     $email->send();
 }
开发者ID:nimeso,项目名称:silverstripe-members,代码行数:13,代码来源:EditProfileForm.php

示例7: send_verification_email

 /**
  * Internal function designed to allow us to send a verification
  * email from multiple locations
  *
  * @param $member Member object to send email to
  * @return boolean
  */
 protected function send_verification_email(Member $member)
 {
     if ($member) {
         $subject = _t("Users.PleaseVerify", "Please verify your account");
         if (Users::config()->send_email_from) {
             $from = Users::config()->send_email_from;
         } else {
             $from = Email::config()->admin_email;
         }
         $body = $this->renderWith('UsersAccountVerification', array("Link" => Controller::join_links(Director::absoluteBaseURL(), $this->config()->url_segment, "verify", $member->ID, $member->VerificationCode)));
         $email = new Email($from, $member->Email, $subject, $body);
         $email->sendPlain();
         return true;
     }
     return false;
 }
开发者ID:spekulatius,项目名称:silverstripe-users,代码行数:23,代码来源:Users_Register_Controller.php

示例8: sendUpdateNotification

 public function sendUpdateNotification($data)
 {
     $name = $data['FirstName'] . " " . $data['Surname'];
     $body = "{$name} has updated their details via the website. Here is the new information:<br/>";
     $notifyOnFields = Member::config()->frontend_update_notification_fields ?: DataObject::database_fields('Member');
     $changedFields = $this->member->getChangedFields(true, 2);
     $send = false;
     foreach ($changedFields as $key => $field) {
         if (in_array($key, $notifyOnFields)) {
             $body .= "<br/><strong>{$key}:</strong><br/>" . "<strike style='color:red;'>" . $field['before'] . "</strike><br/>" . "<span style='color:green;'>" . $field['after'] . "</span><br/>";
             $send = true;
         }
     }
     if ($send) {
         $email = new Email(Email::config()->admin_email, Email::config()->admin_email, "Member details update: {$name}", $body);
         $email->send();
     }
 }
开发者ID:sanderha,项目名称:silverstripe-members,代码行数:18,代码来源:EditProfileForm.php

示例9: like

 /**
  * Like a particular discussion by ID
  *
  */
 public function like()
 {
     $member = Member::currentUser();
     $discussion = Discussion::get()->byID($this->request->param("ID"));
     if ($discussion && $discussion->canView($member)) {
         $this->setSessionMessage("message good", _t("Discussions.Liked", "Liked") . " '{$discussion->Title}'");
         $member->LikedDiscussions()->add($discussion);
         $member->write();
         $author = $discussion->Author();
         // Send a notification (if the author wants it)
         if ($author && $author->RecieveLikedEmails && $author->Email && $member->ID != $author->ID) {
             if (DiscussionHolder::config()->send_email_from) {
                 $from = DiscussionHolder::config()->send_email_from;
             } else {
                 $from = Email::config()->admin_email;
             }
             $subject = _t("Discussions.LikedDiscussionSubject", "{Nickname} liked your discussion", null, array("Nickname" => $member->Nickname));
             // Vars for the emails
             $vars = array("Title" => $discussion->Title, "Member" => $member, 'Link' => Controller::join_links($this->Link("view"), $discussion->ID, "#comments-holder"));
             $email = new Email($from, $author->Email, $subject);
             $email->setTemplate('LikedDiscussionEmail');
             $email->populateTemplate($vars);
             $email->send();
         }
     }
     return $this->redirect(Controller::join_links($this->Link("view"), $discussion->ID));
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-discussions,代码行数:31,代码来源:DiscussionHolder_Controller.php

示例10: run

 function run($request)
 {
     $update = array();
     $orderStep = singleton("OrderStep");
     $orderStep->requireDefaultRecords();
     // ACCOUNT PAGE
     $accountPage = AccountPage::get()->First();
     if (!$accountPage) {
         $accountPage = new AccountPage();
         $accountPage->Title = 'Account';
         $accountPage->MenuTitle = 'Account';
         $accountPage->MetaTitle = 'Account';
         $accountPage->Content = '<p>This is the account page. It is used for shop users to login and change their member details if they have an account.</p>';
         $accountPage->URLSegment = 'account';
         $accountPage->ShowInMenus = 0;
         $accountPage->writeToStage('Stage');
         $accountPage->publish('Stage', 'Live');
         DB::alteration_message('Account page \'Account\' created', 'created');
     } else {
         DB::alteration_message('No need to create an account page, it already exists.');
     }
     //CHECKOUT PAGE
     //CHECKOUT PAGE
     $checkoutPage = CheckoutPage::get()->First();
     if (!$checkoutPage) {
         $checkoutPage = new CheckoutPage();
         $checkoutPage->Content = '<p>This is the checkout page. You can edit all the messages in the Content Management System.</p>';
         $checkoutPage->Title = 'Checkout';
         $checkoutPage->TermsAndConditionsMessage = 'You must agree with the terms and conditions to proceed. ';
         $checkoutPage->MetaTitle = 'Checkout';
         $checkoutPage->MenuTitle = 'Checkout';
         $checkoutPage->URLSegment = 'checkout';
         $update[] = 'Checkout page \'Checkout\' created';
         $checkoutPage->ShowInMenus = 0;
         DB::alteration_message('new checkout page created.', 'created');
     } else {
         DB::alteration_message('No need to create an checkout page, it already exists.');
     }
     if ($checkoutPage) {
         if ($checkoutPage->TermsPageID == 0 && ($termsPage = Page::get()->Filter(array("URLSegment" => "terms-and-conditions"))->First())) {
             $checkoutPage->TermsPageID = $termsPage->ID;
             DB::alteration_message('terms and conditions page linked.', "created");
         } else {
             DB::alteration_message('No terms and conditions page linked.');
         }
         $checkoutPage->writeToStage('Stage');
         $checkoutPage->publish('Stage', 'Live');
         DB::alteration_message('Checkout page saved');
         $orderConfirmationPage = OrderConfirmationPage::get()->First();
         if ($orderConfirmationPage) {
             DB::alteration_message('No need to create an Order Confirmation Page. It already exists.');
         } else {
             $orderConfirmationPage = new OrderConfirmationPage();
             $orderConfirmationPage->ParentID = $checkoutPage->ID;
             $orderConfirmationPage->Title = 'Order confirmation';
             $orderConfirmationPage->MenuTitle = 'Order confirmation';
             $orderConfirmationPage->MetaTitle = 'Order confirmation';
             $orderConfirmationPage->Content = '<p>This is the order confirmation page. It is used to confirm orders after they have been placed in the checkout page.</p>';
             $orderConfirmationPage->URLSegment = 'order-confirmation';
             $orderConfirmationPage->ShowInMenus = 0;
             $orderConfirmationPage->writeToStage('Stage');
             $orderConfirmationPage->publish('Stage', 'Live');
             DB::alteration_message('Order Confirmation created', 'created');
         }
     }
     $update = array();
     $ecommerceConfig = EcommerceDBConfig::current_ecommerce_db_config();
     if ($ecommerceConfig) {
         if (!$ecommerceConfig->ReceiptEmail) {
             $ecommerceConfig->ReceiptEmail = Email::config()->admin_email;
             if (!$ecommerceConfig->ReceiptEmail) {
                 user_error("you must set an AdminEmail (Email::setAdminEmail)", E_USER_NOTICE);
             }
             $update[] = "created default entry for ReceiptEmail";
         }
         if (!$ecommerceConfig->NumberOfProductsPerPage) {
             $ecommerceConfig->NumberOfProductsPerPage = 12;
             $update[] = "created default entry for NumberOfProductsPerPage";
         }
         if (count($update)) {
             $ecommerceConfig->write();
             DB::alteration_message($ecommerceConfig->ClassName . " created/updated: " . implode(" --- ", $update), 'created');
         }
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:85,代码来源:EcommerceTaskDefaultRecords.php

示例11: run

 public function run($request)
 {
     $config = SiteConfig::current_site_config();
     $default = Email::config()->admin_email;
     $default_config = $config->DefaultFromEmail;
     $member = Member::currentUser();
     $to = $request->getVar('email');
     $template = $request->getVar('template');
     $disabled = $request->getVar('disabled');
     if ($disabled) {
         MandrillMailer::setSendingDisabled();
     }
     if ($default) {
         echo "Default email address is {$default}<br/>";
     } else {
         echo "<div style='color:red'>Default email is not set. You should define one!</div>";
     }
     if ($default_config) {
         echo "Default email set in siteconfig is {$default_config}<br/>";
     }
     echo "The email will be sent to admin email, current member or an email passed in the url, like ?email=myemail@test.com<br/>";
     echo "A default email is used by default. You can use a preset template by setting ?template=mytemplate<br/>";
     echo "To prevent email from being sent, you can pass ?disabled=1<br/>";
     echo '<hr/>';
     if (!$default && $default_config) {
         $default = $default_config;
     }
     if (!$member && !$to) {
         if (!$default) {
             echo 'There are no recipient defined!';
             exit;
         } else {
             $to = $default;
         }
     }
     if ($template) {
         $emailTemplate = EmailTemplate::getByCode($template);
         $email = $emailTemplate->getEmail();
         $email->setSubject('Template ' . $template . ' from ' . $config->Title);
         $email->setSampleRequiredObjects();
     } else {
         $email = new MandrillEmail();
         $email->setSampleContent();
         $email->setSubject('Sample email from ' . $config->Title);
     }
     if (!$to) {
         $email->setToMember($member);
     } else {
         $member = Member::get()->filter('Email', $to)->first();
         if ($member) {
             $email->setToMember($member);
         } else {
             $email->setTo($to);
         }
     }
     echo 'Sending to ' . htmlentities($email->To()) . '<br/>';
     echo 'Using theme : ' . $email->getTheme() . '<br/>';
     echo '<hr/>';
     $res = $email->send();
     // Success!
     if ($res && is_array($res)) {
         echo '<div style="color:green">Successfully sent your email</div>';
         echo 'Recipient : ' . $res[0] . '<br/>';
         echo 'Additionnal headers : <br/>';
         foreach ($res[3] as $k => $v) {
             echo "{$k} : {$v}" . '<br/>';
         }
         echo 'Content : ' . $res[2];
     } else {
         echo '<div style="color:red">Failed to send email</div>';
         echo 'Error is : ' . MandrillMailer::getInstance()->getLastError();
     }
 }
开发者ID:zarocknz,项目名称:silverstripe-mandrill,代码行数:73,代码来源:SendTestEmailTask.php

示例12: ini_set

    if (class_exists('DynamicCache')) {
        DynamicCache::config()->enabled = false;
    }
    // See where are included files
    Config::inst()->update('SSViewer', 'source_file_comments', true);
    // Fix this issue https://github.com/silverstripe/silverstripe-framework/issues/4146
    if (isset($_GET['flush'])) {
        i18n::get_cache()->clean(Zend_Cache::CLEANING_MODE_ALL);
    }
} else {
    // In production, sanitize php environment to avoid leaking information
    ini_set('display_errors', false);
    // Hide where are included files
    Config::inst()->update('SSViewer', 'source_file_comments', false);
    // Warn admin if errors occur
    SS_Log::add_writer(new SS_LogEmailWriter(Email::config()->admin_email), SS_Log::ERR, '<=');
}
// Protect website if env = isTest
if (Director::isTest()) {
    // If php runs under cgi, Http auth might not work by default. Don't forget to update htaccess
    if (!isset($_SERVER['PHP_AUTH_USER'])) {
        if (isset($_SERVER['HTTP_AUTHORIZATION']) && strlen($_SERVER['HTTP_AUTHORIZATION']) > 0) {
            list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
            if (strlen($_SERVER['PHP_AUTH_USER']) == 0 || strlen($_SERVER['PHP_AUTH_PW']) == 0) {
                unset($_SERVER['PHP_AUTH_USER']);
                unset($_SERVER['PHP_AUTH_PW']);
            }
        }
    }
    BasicAuth::protect_entire_site();
}
开发者ID:lekoala,项目名称:silverstripe-devtoolkit,代码行数:31,代码来源:_config.php

示例13: previewTab

 /**
  * Provide content for the Preview tab
  * 
  * @return \Tab
  */
 protected function previewTab()
 {
     $tab = new Tab('Preview');
     // Preview iframe
     $previewLink = '/admin/emails/EmailTemplate/PreviewEmail/?id=' . $this->ID;
     $iframe = new LiteralField('iframe', '<iframe src="' . $previewLink . '" style="width:800px;background:#fff;min-height:500px;vertical-align:top"></iframe>');
     $tab->push($iframe);
     if (class_exists('CmsInlineFormAction')) {
         // Test emails
         $compo = new FieldGroup($recipient = new TextField('SendTestEmail', ''), $action = new CmsInlineFormAction('doSendTestEmail', 'Send'));
         $recipient->setAttribute('placeholder', 'my@email.test');
         $recipient->setValue(Email::config()->admin_email);
         $tab->push(new HiddenField('EmailTemplateID', '', $this->ID));
         $tab->push(new HeaderField('SendTestEmailHeader', 'Send test email'));
         $tab->push($compo);
     }
     return $tab;
 }
开发者ID:Olliepop,项目名称:silverstripe-mandrill,代码行数:23,代码来源:EmailTemplate.php

示例14: sendStatusChange

 /**
  * Send a message to the client containing the latest
  * note of {@link OrderStatusLog} and the current status.
  *
  * Used in {@link OrderReport}.
  *
  * @param string $note Optional note-content (instead of using the OrderStatusLog)
  */
 public function sendStatusChange($title, $note = null)
 {
     if (!$note) {
         $latestLog = OrderStatusLog::get()->filter("OrderID", $this->order->ID)->filter("SentToCustomer", 1)->first();
         if ($latestLog) {
             $note = $latestLog->Note;
             $title = $latestLog->Title;
         }
     }
     $member = $this->order->Member();
     if (Config::inst()->get('OrderProcessor', 'receipt_email')) {
         $adminEmail = Config::inst()->get('OrderProcessor', 'receipt_email');
     } else {
         $adminEmail = Email::config()->admin_email;
     }
     $e = new Order_statusEmail();
     $e->populateTemplate(array("Order" => $this->order, "Member" => $member, "Note" => $note));
     $e->setFrom($adminEmail);
     $e->setSubject($title);
     $e->setTo($member->Email);
     $e->send();
 }
开发者ID:helpfulrobot,项目名称:silvershop-core,代码行数:30,代码来源:OrderEmailNotifier.php

示例15: setToAdmin

 /**
  * Send to admin
  *
  * @return Email
  */
 public function setToAdmin()
 {
     $email = Email::config()->admin_email;
     $sc = SiteConfig::current_site_config();
     if ($sc->DefaultToEmail) {
         $email = $sc->DefaultToEmail;
     } elseif ($sc->ContactEmail) {
         $email = $sc->ContactEmail;
     }
     return $this->setTo($email);
 }
开发者ID:zarocknz,项目名称:silverstripe-mandrill,代码行数:16,代码来源:MandrillEmail.php


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