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


PHP Email::sendPlain方法代码示例

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


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

示例1: sendMail

 /**
  * @param $data
  * @return bool
  * Send email with data user input
  */
 public function sendMail($data)
 {
     $from = $data['Email'];
     $to = self::$email;
     $subject = $data['Subject'];
     $body = "Name: {$data['Name']}\r\nPhone Number: {$data['Phone']}\r\nMessage: {$data['Message']}";
     $email = new Email($from, $to, $subject, $body);
     return $email->sendPlain();
 }
开发者ID:shawn3a,项目名称:ss_powermoney,代码行数:14,代码来源:ContactPage.php

示例2: __destruct

 /**
  * If emailLogFileTo and logFilePathName is set then email the logFilePathName content if not empty
  */
 public function __destruct()
 {
     if ($this->emailLogFileTo && $this->logFilePathName) {
         if ($body = file_get_contents($this->logFilePathName)) {
             $email = new \Email($this->config()->get('send_emails_from'), $this->emailLogFileTo, 'Debug log from: ' . \Director::protocolAndHost(), $body);
             $email->sendPlain();
         }
     }
 }
开发者ID:CrackerjackDigital,项目名称:silverstripe-modular,代码行数:12,代码来源:Debugger.php

示例3: onSubmit

 public function onSubmit(array $data, FlexiForm $form, SS_HTTPRequest $request, DataObject $flexi)
 {
     if (parent::onSubmit($data, $form, $request, $flexi)) {
         // extraplate emails and send notifications
         $emails = $flexi->FlexiFormSetting('NotificationEmails')->getValue();
         if (!empty($emails)) {
             //$from = $flexi->FlexiFormSetting('NotificationFromAddress')->getValue() ?: null;
             $email = new Email(null, $emails, 'Submission from form: ' . $flexi->FlexiFormID(), $this->getEmailBody());
             $email->sendPlain();
         }
         return true;
     }
     return false;
 }
开发者ID:helpfulrobot,项目名称:briceburg-silverstripe-flexiform,代码行数:14,代码来源:FlexiFormEmailHandler.php

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

示例5: send

 /**
  *
  * @param Null|String $messageID - ID for the message, you can leave this blank
  * @param Order $order - the order to which the email relates
  * @param Boolean $resend - should the email be resent even if it has been sent already?
  * @return Boolean - TRUE for success and FALSE for failure.
  */
 public function send($messageID = null, $order, $resend = false)
 {
     if (!$this->subject) {
         $this->subject = self::get_subject();
     }
     $this->subject = str_replace("[OrderNumber]", $order->ID, $this->subject);
     if (!$this->hasBeenSent($order) || $resend) {
         if (EcommerceConfig::get("Order_Email", "copy_to_admin_for_all_emails") && $this->to != Email::getAdminEmail()) {
             $this->setBcc(Email::getAdminEmail());
         }
         if (EcommerceConfig::get("Order_Email", "send_all_emails_plain")) {
             $result = parent::sendPlain($messageID);
         } else {
             $result = parent::send($messageID);
         }
         $this->createRecord($result, $order);
         return $result;
     }
 }
开发者ID:nieku,项目名称:silverstripe-ecommerce,代码行数:26,代码来源:Order_Email.php

示例6: testSendPlain

 public function testSendPlain()
 {
     // Set custom $project - used in email headers
     global $project;
     $oldProject = $project;
     $project = 'emailtest';
     Email::set_mailer(new EmailTest_Mailer());
     $email = new Email('from@example.com', 'to@example.com', 'Test send plain', 'Testing Email->sendPlain()', null, 'cc@example.com', 'bcc@example.com');
     $email->attachFile(__DIR__ . '/fixtures/attachment.txt', null, 'text/plain');
     $email->addCustomHeader('foo', 'bar');
     $sent = $email->sendPlain(123);
     // Restore old project name after sending
     $project = $oldProject;
     $this->assertEquals('to@example.com', $sent['to']);
     $this->assertEquals('from@example.com', $sent['from']);
     $this->assertEquals('Test send plain', $sent['subject']);
     $this->assertEquals('Testing Email->sendPlain()', $sent['content']);
     $this->assertEquals(array(0 => array('contents' => 'Hello, I\'m a text document.', 'filename' => 'attachment.txt', 'mimetype' => 'text/plain')), $sent['files']);
     $this->assertEquals(array('foo' => 'bar', 'X-SilverStripeMessageID' => 'emailtest.123', 'X-SilverStripeSite' => 'emailtest', 'Cc' => 'cc@example.com', 'Bcc' => 'bcc@example.com'), $sent['customheaders']);
 }
开发者ID:congaaids,项目名称:silverstripe-framework,代码行数:20,代码来源:EmailTest.php

示例7: Send

 public function Send($data, Form $form)
 {
     Session::set('ContactData', $data);
     $from = $data['Email'];
     $to = $this->SendEmail;
     $subject = $data['Subject'] . ' - through beardpapa.co.nz contact form';
     $body = $data['Message'];
     $email = new Email($from, $to, $subject, $body);
     $flag = $email->sendPlain();
     if ($flag) {
         $result['Message'] = 'You submission is successful, thank you.';
         $result['Type'] = 'good';
         Session::clear('ContactData');
     } else {
         $result['Message'] = 'Sorry your submission is unsuccessful, please try again or call our branch phone number.';
         $result['Type'] = 'bad';
     }
     $result['Title'] = 'Contact Us';
     $result['BackURL'] = '/contact-us';
     return $this->customise($result)->renderWith(array('ResultPage', 'Page'));
 }
开发者ID:shawn3a,项目名称:beardpapa,代码行数:21,代码来源:ContactPage.php

示例8: index

 function index($request)
 {
     if (!Permission::check("ADMIN")) {
         return Security::permissionFailure($this);
     }
     $email = $request->requestVar($name = "email");
     if ($email && Email::validEmailAddress($email)) {
         $number = rand(0, 10000);
         $from = Email::getAdminEmail();
         $to = $email;
         $subject = "test mail ID" . $number;
         $body = "test mail ID" . $number;
         $htmlBody = "<h1>test mail ID" . $number . '</h1>';
         $basicMailOk = @mail($email, $subject, $body);
         if ($basicMailOk) {
             DB::alteration_message("basic mail (using the PHP mail function)  has been sent with ID: " . $number, "created");
         } else {
             DB::alteration_message("basic mail (using the PHP mail function) has * NOT * been sent with ID:" . $number, "deleted");
         }
         $e = new Email($from, $to, $subject, $body);
         if ($e->send()) {
             DB::alteration_message("standard Silverstripe email has been sent with ID: " . $number, "created");
         } else {
             DB::alteration_message("standard Silverstripe email ***NOT*** has been sent with ID: " . $number, "deleted");
         }
         //OR
         $e = new Email($from, $to, $subject, $body);
         if ($e->sendPlain()) {
             DB::alteration_message("plain text Silverstripe  email has been sent with ID: " . $number, "created");
         } else {
             DB::alteration_message("plain text Silverstripe email has ***NOT*** been sent with ID: " . $number, "deleted");
         }
     } else {
         user_error("make sure to add a valid email - current one is '" . $email . "' (you can add the email like this: " . $request->getURL() . "?email=myemail@test.com", E_USER_WARNING);
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-testmailer,代码行数:36,代码来源:TestIfEmailsAreWorking.php

示例9: Send

 public function Send($data, Form $form)
 {
     Session::set('FranchiseData', $data);
     $from = $data['Email'];
     $to = $this->SendEmail;
     $subject = 'Franchise Information';
     $body = "First Name: " . $data['FirstName'] . "\r\n" . "Last Name: " . $data['LastName'] . "\r\n" . "Email: " . $data['Email'] . "\r\n" . "Contact: " . $data['Contact'] . "\r\n" . "Best Calling Time: " . $data['CallingTime'] . "\r\n" . "Liquid Capital: " . $data['LiquidCapital'] . "\r\n" . "Time Frame to Start: " . $data['TimeStart'] . "\r\n" . "In what area are you looking to invest in a franchise?: \r\n" . $data['Area'] . "\r\n" . "Business & Relevant Experience: \r\n" . $data['Experience'] . "\r\n" . "How did you hear about the Beard Papa’s franchise: \r\n" . $data['Hear'] . "\r\n";
     if (array_key_exists('Message', $data)) {
         $body .= "Message: " . $data['Message'] . "\r\n";
     }
     $email = new Email($from, $to, $subject, $body);
     $flag = $email->sendPlain();
     if ($flag) {
         $result['Message'] = 'You submission is successful, thank you.';
         $result['Type'] = 'good';
         Session::clear('FranchiseData');
     } else {
         $result['Message'] = 'Sorry your submission is unsuccessful, please try again or contact us.';
         $result['Type'] = 'bad';
     }
     $result['Title'] = 'Franchising';
     $result['BackURL'] = '/franchise';
     return $this->customise($result)->renderWith(array('ResultPage', 'Page'));
 }
开发者ID:shawn3a,项目名称:beardpapa,代码行数:24,代码来源:FranchisePage.php

示例10: sendViaEmail

 /**
  * Send an email to a single recipient
  *
  * @param PipelineStep $source Client step
  * @param string $from
  * @param string $to
  * @param string $subject
  * @param string $body
  */
 protected function sendViaEmail($source, $from, $to, $subject, $body)
 {
     $email = new Email($from, $to, $subject, $body);
     if ($source->getDryRun()) {
         $source->log("[Skipped] Sent message to {$to} (subject: {$subject})");
     } else {
         $email->sendPlain();
         $source->log("Sent message to {$to} (subject: {$subject})");
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-deploynaut,代码行数:19,代码来源:EmailMessagingService.php

示例11: doSend

 /**
  * Sends the a plain or HTML version of the email
  * @param  int  $messageID 
  * @param  boolean $plain     	 
  */
 protected function doSend($messageID = null, $plain = false)
 {
     if (!$this->Subject() && $this->getUserTemplate()) {
         $this->setSubject($this->getUserTemplate()->Subject);
     }
     $from = $this->From();
     $config = Config::inst()->forClass('Email');
     if (!$from) {
         if ($this->getUserTemplate()) {
             $from = $this->getUserTemplate()->From;
         }
         if (!$from) {
             $from = $config->send_all_emails_from ?: $config->admin_email;
         }
         $this->setFrom($from);
     }
     // Check if a list of Member objects has been given
     if ($this->members) {
         foreach ($this->members as $m) {
             $this->setTo($m->Email);
             $this->populateTemplate(array('RecipientMember' => $m));
         }
     }
     if ($this->config()->test_mode) {
         $this->parseVariables($plain);
     } else {
         if ($plain) {
             parent::sendPlain($messageID);
         } else {
             parent::send($messageID);
         }
     }
     $this->persist();
 }
开发者ID:helpfulrobot,项目名称:smarcet-silverstripe-permamail,代码行数:39,代码来源:Permamail.php

示例12: send

 /**
  *
  * @param Null|String $messageID - ID for the message, you can leave this blank
  * @param Boolean $returnBodyOnly - rather than sending the email, only return the HTML BODY
  * @return Boolean - TRUE for success and FALSE for failure.
  */
 public function send($messageID = null, $returnBodyOnly = false)
 {
     if (!$this->order) {
         user_error("Must set the order (Order_Email::setOrder()) before the message is sent (Order_Email::send()).", E_USER_NOTICE);
     }
     if (!$this->subject) {
         $this->subject = self::get_subject();
     }
     $this->subject = str_replace("[OrderNumber]", $this->order->ID, $this->subject);
     if (!$this->hasBeenSent() || $this->resend) {
         if (EcommerceConfig::get("Order_Email", "copy_to_admin_for_all_emails") && $this->to != Order_Email::get_from_email()) {
             $this->setBcc(Order_Email::get_from_email());
         }
         //last chance to adjust
         $this->extend("adjustOrderEmailSending", $this, $order);
         if ($returnBodyOnly) {
             return $this->Body();
         }
         if (EcommerceConfig::get("Order_Email", "send_all_emails_plain")) {
             $result = parent::sendPlain($messageID);
         } else {
             $result = parent::send($messageID);
         }
         $this->createRecord($result);
         return $result;
     }
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:33,代码来源:Order_Email.php

示例13: onAfterWrite

 /**
  * API Callback after this object is written to the DB
  *
  */
 public function onAfterWrite()
 {
     parent::onAfterWrite();
     // Check if an order number has been generated, if not, add it and save again
     if (!$this->OrderNumber) {
         $this->OrderNumber = $this->generate_order_number();
         $this->write();
     }
     // Deal with sending the status email
     if ($this->isChanged('Status') && in_array($this->Status, array('failed', 'paid', 'processing', 'dispatched'))) {
         $siteconfig = SiteConfig::current_site_config();
         $from = $siteconfig->EmailFromAddress;
         $vars = array('Order' => $this, 'SiteConfig' => $siteconfig);
         // Deal with customer email
         if ($siteconfig->sendCommerceEmail('Customer', $this->Status)) {
             // if subsites installed, then get the native language for that site
             $current_i18n = i18n::get_locale();
             if ($this->SubsiteID && class_exists('Subsite') && $this->Subsite()) {
                 i18n::set_locale($this->Subsite()->Language);
             }
             $subject = _t('CommerceEmail.Order', 'Order') . " {$this->OrderNumber} {$this->getTranslatedStatus()}";
             $body = $this->renderWith('OrderEmail_Customer', $vars);
             $email = new Email($from, $this->Email, $subject, $body);
             $email->sendPlain();
             // If subsites enabled, set the language back
             if ($this->SubsiteID && class_exists('Subsite') && $this->Subsite()) {
                 i18n::set_locale($current_i18n);
             }
         }
         // Deal with vendor email
         if ($siteconfig->sendCommerceEmail('Vendor', $this->Status)) {
             $subject = _t('CommerceEmail.Order', 'Order') . " {$this->OrderNumber} {$this->getTranslatedStatus()}";
             switch ($this->Status) {
                 case 'paid':
                     $email_to = $siteconfig->PaidEmailAddress;
                 case 'processing':
                     $email_to = $siteconfig->ProcessingEmailAddress;
                 case 'dispatched':
                     $email_to = $siteconfig->DispatchedEmailAddress;
             }
             if (isset($email_to)) {
                 $body = $this->renderWith('OrderEmail_Vendor', $vars);
                 $email = new Email($from, $email_to, $subject, $body);
                 $email->sendPlain();
             }
         }
     }
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-commerce,代码行数:52,代码来源:Order.php

示例14: doSendFriend

 function doSendFriend($data, $form)
 {
     $copyself = false;
     $the_url = $data['sendurl'];
     $yourname = trim($data['YourName']);
     $youremail = trim($data['YourEmail']);
     $toname = trim($data['ToName']);
     $toemail = trim($data['ToEmail']);
     $remarks = trim($data['Remarks']);
     if (isset($data['CopySelf'])) {
         $copyself = $data['CopySelf'];
     }
     // do a check on the sent url and email addresses
     $this->checkSentUrl($the_url);
     $this->spamCheck($toemail);
     $this->spamCheck($youremail);
     $from = $yourname . '<' . $youremail . '>';
     $to = $toname . '<' . $toemail . '>';
     $subject = _t('SendFriend.SUBJECT', 'Interesting article on ') . SiteConfig::current_site_config()->getTitle();
     $body = '';
     $body .= _t('SendFriend.DEAR', 'Dear ') . $toname . ",\n\n";
     $body .= $yourname . _t('SendFriend.TEXT', ' would like to let you know about the following page: ') . "\n\n";
     $body .= $the_url . "\n\n";
     if (trim($remarks) != '') {
         $body .= _t('SendFriend.MESSAGEFROM', 'Message from ') . $yourname . ":\n " . $remarks . "\n\n";
     }
     $email = new Email($from, $to, $subject, $body);
     $email->sendPlain();
     if ($copyself) {
         $body = _t('SendFriend.COPYOFMESSAGE', '--- copy of message to ') . $toname . " ---\n\n" . $body;
         $email = new Email($from, $from, $subject, $body);
         $email->sendPlain();
     }
     return $this->customise($data)->renderWith(array('SendFriendController_sent', 'SendFriendController'));
 }
开发者ID:helpfulrobot,项目名称:hubertusanton-silverstripe-sendfriend,代码行数:35,代码来源:SendFriendController.php


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