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


PHP Mail::Instance方法代码示例

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


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

示例1: save

    public function save()
    {
        $category = ContactForm::$Categories[$this->category];
        $subject = '[Contact Form] ' . $this->subject;
        $message = <<<BLOCK
            Category: {$category} <br />
            Subject: {$this->subject} <br />
            Message: {$this->message} <br />
BLOCK;
        Mail::Instance()->Alert($subject, $message);
    }
开发者ID:noahkim,项目名称:kowop,代码行数:11,代码来源:ContactForm.php

示例2: Alert

 public function Alert($subject, $message)
 {
     $alertTo = array("ilija1@gmail.com", "ilija@kowop.com", "noah@kowop.com");
     $errors = '';
     foreach ($alertTo as $to) {
         try {
             Mail::Instance()->Send($to, $subject, $message);
         } catch (Exception $e) {
             $errors .= "Error sending mail to {$to}.\n";
         }
     }
     Yii::log($errors, 'info', 'email');
 }
开发者ID:noahkim,项目名称:kowop,代码行数:13,代码来源:Mail.php

示例3: SendMessage

 public static function SendMessage($to, $from, $text, $replyTo = null)
 {
     $message = new Message();
     $message->Type = MessageType::Message;
     $message->To = $to;
     $message->From = $from;
     $message->Content = $text;
     if ($replyTo != null && is_numeric($replyTo)) {
         $message->Parent_ID = $replyTo;
     }
     $message->save();
     Mail::Instance()->Send($message->to->Email, "{$message->from->display} has sent you a message.", $text);
 }
开发者ID:noahkim,项目名称:kowop,代码行数:13,代码来源:Message.php

示例4: BalancedCallback

 public static function BalancedCallback($post)
 {
     Yii::import('application.extensions.vendor.autoload', true);
     Httpful\Bootstrap::init();
     Balanced\Bootstrap::init();
     Balanced\Settings::$api_key = Yii::app()->params['balancedAPISecret'];
     $log = "Received callback... \n";
     try {
         $data = json_decode($post);
         if (!isset($data->type)) {
             $log .= "Error parsing data: \n";
             $log .= "Raw post: \n" . $post . "\n";
             $log .= "Parsed data: \n" . print_r($data, true) . "\n";
             throw new Exception("Error parsing data");
         }
         if ($data->type == 'debit.succeeded') {
             try {
                 $log .= "Customer debit succeeded. Paying the host...\n";
                 $paymentID = $data->entity->meta->Payment_ID;
                 $log .= "Payment_ID: {$paymentID}\n";
                 $payment = Payment::model()->findByPk($paymentID);
                 $hostAmount = $payment->Amount * Yii::app()->params['HostPercentage'];
                 $log .= "Host's share is \${$hostAmount}\n";
                 // Convert to cents
                 $hostAmount *= 100;
                 $hostBankAccount = Balanced\BankAccount::get($payment->bankAccount->URI);
                 $credit = $hostBankAccount->credit($hostAmount);
                 $log .= 'Sent credit, response is: ' . print_r($credit, true) . "\n";
             } catch (Exception $e) {
                 Mail::Instance()->Alert("Error crediting host account", print_r($e));
                 throw $e;
             }
         } else {
             $log .= print_r($data, true) . "\n";
         }
     } catch (Exception $e) {
         $log .= "\n" . print_r($e, true);
     }
     Yii::log($log, 'info', 'BalancedCallback');
 }
开发者ID:noahkim,项目名称:kowop,代码行数:40,代码来源:Payment.php

示例5: SignUp

 public function SignUp($session = null, $quantity = 1, $creditCard = null)
 {
     $transaction = $this->dbConnection->beginTransaction();
     try {
         $user = User::model()->findByPk(Yii::app()->user->id);
         if ($this->Create_User_ID == $user->User_ID) {
             throw new Exception("Can't sign up for own experience.");
         }
         $userToExperience = new UserToExperience();
         $userToExperience->User_ID = $user->User_ID;
         $userToExperience->Experience_ID = $this->Experience_ID;
         if ($session == null) {
             $existing = UserToExperience::model()->find('User_ID=:User_ID AND Experience_ID=:Experience_ID', array(':User_ID' => $user->User_ID, ':Experience_ID' => $this->Experience_ID));
         } else {
             $existing = UserToExperience::model()->find('User_ID=:User_ID AND Session_ID=:Session_ID AND Experience_ID=:Experience_ID', array(':User_ID' => $user->User_ID, ':Session_ID' => $session, ':Experience_ID' => $this->Experience_ID));
             $userToExperience->Session_ID = $session;
         }
         if ($this->MaxPerPerson != null) {
             if ($quantity > $this->MaxPerPerson) {
                 throw new Exception("Quantity exceeds limit.");
             }
         }
         $userToExperience->Quantity = $quantity;
         if ($existing != null && !$this->MultipleAllowed) {
             throw new Exception("Can't sign up multiple times.");
         }
         $confirmationCode = $this->code;
         if (isset($this->Price) && $this->Price != null && $this->Price > 0) {
             $amount = $quantity * $this->Price;
             $scheduledFor = strtotime('+' . Yii::app()->params["PaymentDelay"] . ' days');
             if ($session != null) {
                 $sessionModel = Session::model()->findByPk($session);
                 $start = strtotime($sessionModel->Start);
                 if ($start < time()) {
                     throw new Exception("Session starts in the past.");
                 }
                 if ($start < $scheduledFor) {
                     $scheduledFor = $start;
                 }
             }
             $payment = new Payment();
             $payment->Experience_ID = $this->Experience_ID;
             $payment->CreditCard_ID = $creditCard;
             $payment->BankAccount_ID = $this->createUser->bankAccount->BankAccount_ID;
             $payment->Amount = $amount;
             $payment->Batch_ID = uniqid();
             $payment->ScheduledFor = date('Y-m-d H:i:s', $scheduledFor);
             $payment->Status = PaymentStatus::Scheduled;
             $payment->save();
             $confirmationCode = $payment->code;
         }
         $userToExperience->save();
         $userName = CHtml::link($user->fullName, array('user/view', 'id' => $user->User_ID));
         $experienceName = CHtml::link($this->Name, array('experience/view', 'id' => $this->Experience_ID));
         Message::SendNotification($this->Create_User_ID, "{$userName} has joined your experience \"{$experienceName}\".");
         // Notify the enrollees
         foreach ($this->enrolled as $enrollee) {
             if ($enrollee->User_ID != $user->User_ID) {
                 $userName = CHtml::link($user->fullName, array('user/view', 'id' => $user->User_ID));
                 $experienceName = CHtml::link($this->Name, array('experience/view', 'id' => $this->Experience_ID));
                 Message::SendNotification($enrollee->User_ID, "{$userName} has also joined the experience \"{$experienceName}\".");
             }
         }
         if (!is_numeric($quantity)) {
             $quantity = 1;
         }
         $models = array('model' => $this, 'confirmationCode' => $confirmationCode, 'quantity' => $quantity);
         Mail::Instance()->SendTemplate($user->Email, 'Signup Confirmation', '/experience/_emailConfirmation', $models);
         $transaction->commit();
     } catch (Exception $e) {
         $transaction->rollback();
         return false;
     }
     return true;
 }
开发者ID:noahkim,项目名称:kowop,代码行数:75,代码来源:Experience.php


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