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


PHP Notification::sendEmail方法代码示例

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


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

示例1: foreach

// Make sure this is the first time
// the user has used the website
if (!User::firstUse()) {
    Session::setError('Cannot register, you have already registered before.');
    Session::redirect('/');
}
// If the request is post, try and sign them up
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    foreach ($_POST['register'] as $key => $value) {
        if (is_array($value)) {
            $result = User::setEducation($value);
        } else {
            $result = User::setAttribute($key, $value);
        }
        if ($result == false) {
            Session::setError('Unable to complete your registration, please try again.');
            Session::redirect('/register');
        }
    }
    $user = User::getUser();
    $registration = UTSHelpsAPI::RegisterStudent(['StudentId' => $user['student_id'], 'DateOfBirth' => $user['dob'], 'Gender' => $user['gender'], 'Degree' => $user['degree'], 'Status' => $user['status'], 'FirstLanguage' => $user['first_language'], 'CountryOrigin' => $user['country_of_origin'], 'DegreeDetails' => $user['year'], 'AltContact' => $user['best_contact_no'], 'PreferredName' => $user['preferred_first_name'], 'HSC' => (bool) $user['hsc'], 'HSCMark' => $user['hsc_mark'], 'IELTS' => (bool) $user['ielts'], 'IELTSMark' => $user['ielts_mark'], 'TOEFL' => (bool) $user['toefl'], 'TOEFLMark' => $user['toefl_mark'], 'TAFE' => (bool) $user['tafe'], 'TAFEMark' => $user['tafe_mark'], 'CULT' => (bool) $user['cult'], 'CULTMark' => $user['cult_mark'], 'InsearchDEEP' => (bool) $user['insearch_deep'], 'InsearchDEEPMark' => $user['insearch_deep_mark'], 'InsearchDiploma' => (bool) $user['insearch_diploma'], 'InsearchDiplomaMark' => $user['insearch_diploma_mark'], 'FoundationCourse' => (bool) $user['foundation_course'], 'FoundationCourseMark' => $user['foundation_course_mark'], 'CreatorId' => 123456]);
    $message = Notification::renderEmail('emails/registration.html', ['name' => $user['name']]);
    Notification::sendEmail($user['email'], $user['name'], 'Registration Successful', $message);
    User::setFirstUse();
    User::setLastLogin();
    Session::setSuccess('You have successfully saved your registration details.');
    Session::redirect('/');
}
// Get the user
$page['user'] = User::getUser();
$page['educational-backgrounds'] = ['hsc' => ['label' => 'HSC', 'key' => 'hsc'], 'ielts' => ['label' => 'IELTS', 'key' => 'ielts'], 'toefl' => ['label' => 'TOEFL', 'key' => 'toefl'], 'tafe' => ['label' => 'TAFE', 'key' => 'tafe'], 'cult' => ['label' => 'CULT', 'key' => 'cult'], 'insearchDeep' => ['label' => 'Insearch DEEP', 'key' => 'insearchDeep'], 'insearchDiploma' => ['label' => 'Insearch Diploma', 'key' => 'insearchDiploma'], 'foundationCourse' => ['label' => 'Foundation Course', 'key' => 'foundationCourse']];
开发者ID:Outlaw11A,项目名称:SDP2015,代码行数:31,代码来源:register.php

示例2: pathinfo

        $page['field']['taught'] = $_POST['attendance']['taught'];
        $page['field']['learn'] = $_POST['attendance']['learn'];
    } else {
        // Make sure the file name does not contain php in it
        if (strpos($_FILES['attendance']['name']['file'], 'php')) {
            Session::setError('File rejected');
            Session::redirect('/bookings');
        }
        // Make the filename
        $extension = pathinfo($_FILES['attendance']['name']['file'], PATHINFO_EXTENSION);
        $filename = Attendance::generateRandomFileName() . '.' . $extension;
        // Upload file path
        $uploadedFile = $GLOBALS['file-directory'] . basename($filename);
        if (!move_uploaded_file($_FILES['attendance']['tmp_name']['file'], $uploadedFile)) {
            Session::setError('Unable to upload file, please try again.');
            Session::redirect('/bookings');
        }
        $createAttendance = Attendance::createAttendance($bookingId, $page['booking']->workshopID, $_POST['attendance']['learn'], $_POST['attendance']['taught'], $filename);
        $updateBooking = UTSHelpsAPI::UpdateWorkshopBooking(['workshopId' => $page['booking']->workshopID, 'studentId' => User::getPaddedId(), 'Attended' => 1, 'Canceled' => 0, 'userId' => 123]);
        if ($createAttendance && $updateBooking != null && $updateBooking->IsSuccess == 1) {
            // Send the email notification
            $user = User::getUser();
            $message = Notification::renderEmail('emails/record-attendance.html', ['name' => $user['name'], 'bookingId' => $bookingId]);
            Notification::sendEmail($user['email'], $user['name'], 'Recorded Attendance', $message);
            Session::setSuccess('Successfully recorded attendance for this booking.');
            Session::redirect('/bookings');
        }
        Session::setError('Unable to record attendance for this booking, please try again.');
        Session::redirect('/bookings');
    }
}
开发者ID:Outlaw11A,项目名称:SDP2015,代码行数:31,代码来源:attendance.php

示例3: foreach

// Make sure the id is specified
if (!array_key_exists('id', $_POST) && $_POST['id'] == null) {
    Session::returnJsonMessage(['success' => false, 'message' => 'No workshop ID provided, unable to book workshop.']);
}
$id = $_POST['id'];
// Check if the person hasn't already signed up to the workshop before
$bookings = UTSHelpsAPI::SearchWorkshopBookings(['studentId' => User::getPaddedId(), 'pageSize' => 9999, 'active' => true]);
if ($bookings != null && $bookings->IsSuccess == 1) {
    // Make sure the user hasn't already booked this workshop before.
    foreach ($bookings->Results as $booking) {
        if ($booking->workshopID == (int) $id && $booking->BookingArchived == null) {
            Session::returnJsonMessage(['success' => false, 'message' => 'You have already booked this workshop, unable to book workshop.']);
        }
    }
} else {
    Session::returnJsonMessage(['success' => false, 'message' => 'Unable to book workshop, an unknown error occured.']);
}
// If the user has too many strikes, don't allow them to book.
if (User::getStrikes() >= User::getMaxStrikes()) {
    Session::returnJsonMessage(['success' => false, 'message' => 'Unable to create booking, you have too many strikes.']);
}
// This user hasn't booked the workshop before, we can safely book it now.
$booking = UTSHelpsAPI::CreateWorkshopBooking(['workshopId' => $id, 'studentId' => User::getPaddedId(), 'userId' => 123]);
if ($booking != null && $booking->IsSuccess == 1) {
    // Send the email notification to the user
    $user = User::getUser();
    $message = Notification::renderEmail('emails/booking.html', ['name' => $user['name'], 'workshopId' => $id]);
    Notification::sendEmail($user['email'], $user['name'], 'Booking Created', $message);
    Session::returnJsonMessage(['success' => true, 'message' => 'Successfully booked workshop!']);
}
Session::returnJsonMessage(['success' => false, 'message' => 'Unable to create booking, please try again.']);
开发者ID:Outlaw11A,项目名称:SDP2015,代码行数:31,代码来源:book.php

示例4: actionPasswordReset

 public function actionPasswordReset()
 {
     if (isset($_POST['email'])) {
         $email = $_POST['email'];
         $user = User::model()->find('email=:email', array(':email' => $email));
         if ($user) {
             $newPassword = rand(10000, 99999);
             $user->password = $user->hashPassword($newPassword);
             $user->save();
             //send email
             $senderDetails['name'] = Yii::app()->name;
             $senderDetails['email'] = Yii::app()->params['eamsEmail'];
             $receiverDetails['name'] = $user->first_name;
             $receiverDetails['email'] = $email;
             $subject = "Password Reset";
             $message = "Dear {$user->first_name}\r\n" . "Your new password is: {$newPassword} \r\n" . "Please login and remember to change your password";
             Notification::sendEmail($senderDetails, $receiverDetails, $subject, $message);
             Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_SUCCESS, 'The new password has been sent to your email');
         } else {
             Yii::app()->user->setFlash(TbHtml::ALERT_COLOR_ERROR, 'Email supplied doesn\'t match any user account in the database');
         }
     }
     $this->render('_password_reset_form');
 }
开发者ID:robertgunze,项目名称:eams,代码行数:24,代码来源:UserController.php

示例5:

<?php

// Make sure the id is specified
if (!array_key_exists('id', $_POST) && $_POST['id'] == null) {
    Session::returnJsonMessage(['success' => false, 'message' => 'No workshop ID provided, unable to join workshop waiting list.']);
}
$id = $_POST['id'];
$waitinglist = UTSHelpsAPI::CreateWorkshopWaiting(['workshopId' => $id, 'studentId' => User::getPaddedId(), 'userId' => '123']);
if ($waitinglist != null && $waitinglist->IsSuccess == 1) {
    // Send the email notification
    $user = User::getUser();
    $message = Notification::renderEmail('emails/waiting-list.html', ['name' => $user['name'], 'workshopId' => $id]);
    Notification::sendEmail($user['email'], $user['name'], 'Joined Waiting List', $message);
    Session::returnJsonMessage(['success' => true, 'message' => 'Successfully joined waiting list!']);
}
Session::returnJsonMessage(['success' => false, 'message' => 'Unable to join waiting list, you have already joined it.']);
开发者ID:Outlaw11A,项目名称:SDP2015,代码行数:16,代码来源:join-waiting-list.php


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