• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP email_to_user函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中email_to_user函数的典型用法代码示例。如果您正苦于以下问题:PHP email_to_user函数的具体用法?PHP email_to_user怎么用?PHP email_to_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: send

 public function send($users = null)
 {
     $this->startTime = time();
     $users = empty($users) ? $this->users : $users;
     $noreplyUser = new stdClass();
     $noreplyUser->firstname = 'Moodle';
     $noreplyUser->lastname = 'Administrator';
     $noreplyUser->username = 'moodleadmin';
     $noreplyUser->email = $this->noreply;
     $noreplyUser->maildisplay = 2;
     $noreplyUser->alternatename = "";
     $noreplyUser->firstnamephonetic = "";
     $noreplyUser->lastnamephonetic = "";
     $noreplyUser->middlename = "";
     if (empty($users)) {
         $this->warnings[] = get_string('no_users', 'block_quickmail');
     }
     foreach ($users as $user) {
         $success = email_to_user($user, $noreplyUser, $this->subject, $this->text, $this->html, '', '', true, $this->noreply, get_string('pluginname', 'block_quickmail'));
         if (!$success) {
             $this->warnings[] = get_string('email_error', 'block_quickmail', $user);
             $this->failuserids[] = $user->id;
         } else {
             $this->sentUsers[] = $user->username;
         }
     }
     $this->endTime = time();
     return $this->failuserids;
 }
开发者ID:amunguia,项目名称:block_quickmail,代码行数:29,代码来源:message.php


示例2: local_sandbox_inform_admin

/**
 * Helper function for sending notification mails
 *
 * @param string $message The message
 * @param int $level Notification level
 * @return
 */
function local_sandbox_inform_admin($message, $level = SANDBOX_LEVEL_NOTICE)
{
    // Get recipients
    $recipients = get_users_from_config(get_config('local_sandbox', 'notifyonerrors'), 'moodle/site:config');
    // If there are no recipients, don't execute.
    if (!is_array($recipients) || count($recipients) <= 0) {
        return false;
    }
    // If message level is below configured notice level, don't execute
    if ($level < get_config('local_sandbox', 'notifylevel')) {
        return false;
    }
    // Get subject
    if ($level > SANDBOX_LEVEL_WARNING) {
        $subject = get_string('emailsubjecterror', 'local_sandbox');
    } else {
        if ($level > SANDBOX_LEVEL_NOTICE) {
            $subject = get_string('emailsubjectwarning', 'local_sandbox');
        } else {
            $subject = get_string('emailsubjectnotice', 'local_sandbox');
        }
    }
    // Send mail
    foreach ($recipients as $r) {
        // Email the admin directly rather than putting these through the messaging system
        email_to_user($r, core_user::get_support_user(), $subject, $message);
    }
}
开发者ID:andrewhancox,项目名称:moodle-local_sandbox,代码行数:35,代码来源:lib.php


示例3: facetoface_send_admin_upgrade_msg

/**
 *
 * Sends message to administrator listing all updated
 * duplicate custom fields
 * @param array $data
 */
function facetoface_send_admin_upgrade_msg($data)
{
    global $SITE;
    // No data - no need to send email.
    if (empty($data)) {
        return;
    }
    $table = new html_table();
    $table->head = array('Custom field ID', 'Custom field original shortname', 'Custom field new shortname');
    $table->data = $data;
    $table->align = array('center', 'center', 'center');
    $title = "{$SITE->fullname}: Face to Face upgrade info";
    $note = 'During the last site upgrade the face-to-face module has been modified. It now
requires session custom fields to have unique shortnames. Since some of your
custom fields had duplicate shortnames, they have been renamed to remove
duplicates (see table below). This could impact on your email messages if you
reference those custom fields in the message templates.';
    $message = html_writer::start_tag('html');
    $message .= html_writer::start_tag('head') . html_writer::tag('title', $title) . html_writer::end_tag('head');
    $message .= html_writer::start_tag('body');
    $message .= html_writer::tag('p', $note) . html_writer::table($table, true);
    $message .= html_writer::end_tag('body');
    $message .= html_writer::end_tag('html');
    $admin = get_admin();
    email_to_user($admin, $admin, $title, '', $message);
}
开发者ID:CWRTP,项目名称:facetoface-2.0,代码行数:32,代码来源:upgrade.php


示例4: send_message

    /**
     * Processes the message (sends by email).
     * @param object $eventdata the event data submitted by the message sender plus $eventdata->savedmessageid
     */
    function send_message($eventdata) {
        global $CFG;

        if (!empty($CFG->noemailever)) {
            // hidden setting for development sites, set in config.php if needed
            debugging('$CFG->noemailever active, no email message sent.', DEBUG_MINIMAL);
            return true;
        }

        //hold onto email preference because /admin/cron.php sends a lot of messages at once
        static $useremailaddresses = array();

        //check user preference for where user wants email sent
        if (!array_key_exists($eventdata->userto->id, $useremailaddresses)) {
            $useremailaddresses[$eventdata->userto->id] = get_user_preferences('message_processor_email_email', $eventdata->userto->email, $eventdata->userto->id);
        }
        $usertoemailaddress = $useremailaddresses[$eventdata->userto->id];

        if ( !empty($usertoemailaddress)) {
            $userto->email = $usertoemailaddress;
        }

        $result = email_to_user($eventdata->userto, $eventdata->userfrom,
            $eventdata->subject, $eventdata->fullmessage, $eventdata->fullmessagehtml);

        return $result;
    }
开发者ID:nuckey,项目名称:moodle,代码行数:31,代码来源:message_output_email.php


示例5: send_email_sessiondeleted

function send_email_sessiondeleted($webinar, $session_info)
{
    global $CFG;
    foreach ($session_info->sessiondates as $dates) {
        $startdatetime = date('d F Y', $dates->timestart) . " at " . date('h:i A', $dates->timestart);
    }
    if ($attendees = webinar_get_attendees($session_info->id)) {
        foreach ($attendees as $user) {
            $a = new stdClass();
            $a->name = $user->firstname . " " . $user->lastname;
            $a->starttime = $startdatetime;
            $a->webinarname = $webinar->name;
            $a->webinarintro = $webinar->description;
            $a->webinaragenda = $webinar->agenda;
            $a->adminemail = $webinar->adminemail;
            //print_r($a);
            $subject = get_string('sessiondeletedsubject', 'webinar', $a);
            $contact = get_string('sessiondeletedcontact', 'webinar', $a);
            $message = get_string('sessiondeletedmessage', 'webinar', $a);
            //last task - strip <p> and </p> from the message before we send the email
            $message = str_replace('<p>', '', $message);
            $message = str_replace('</p>', '', $message);
            email_to_user($user, $contact, $subject, $message);
        }
    }
}
开发者ID:pavelsokolov,项目名称:webinar,代码行数:26,代码来源:sendemailsessiondeleted.php


示例6: send_message

    /**
     * Processes the message (sends by email).
     * @param object $eventdata the event data submitted by the message sender plus $eventdata->savedmessageid
     */
    function send_message($eventdata) {
        global $CFG;

        if (!empty($CFG->noemailever)) {
            // hidden setting for development sites, set in config.php if needed
            debugging('$CFG->noemailever active, no email message sent.', DEBUG_MINIMAL);
            return true;
        }

        //the user the email is going to
        $recipient = null;

        //check if the recipient has a different email address specified in their messaging preferences Vs their user profile
        $emailmessagingpreference = get_user_preferences('message_processor_email_email', null, $eventdata->userto);
        if (!empty($emailmessagingpreference)) {
            //clone to avoid altering the actual user object
            $recipient = clone($eventdata->userto);
            $recipient->email = $emailmessagingpreference;
        } else {
            $recipient = $eventdata->userto;
        }
        $result = email_to_user($recipient, $eventdata->userfrom, $eventdata->subject, $eventdata->fullmessage, $eventdata->fullmessagehtml);

        return $result;
    }
开发者ID:rolandovanegas,项目名称:moodle,代码行数:29,代码来源:message_output_email.php


示例7: send_message

 /**
  * Processes the message (sends by email).
  * @param object $message the message to be sent
  */
 function send_message($message)
 {
     //send an email
     //if fails saved as read message
     //first try to get preference
     $usertoemail = get_user_preferences('message_processor_email_email', '', $message->useridto);
     //if fails use user profile default
     if ($usertoemail == NULL) {
         $userto = get_record('user', 'id', $message->useridto);
         $usertoemail = $userto->email;
     }
     $userfrom = get_record('user', 'id', $message->useridfrom);
     if (email_to_user($usertoemail, $userfrom->email, $message->subject, $message->fullmessage, $message->fullmessagehtml)) {
         /// Move the entry to the other table
         $message->timeread = time();
         $messageid = $message->id;
         unset($message->id);
         //if there is no more processor that want to process this can move message
         if (count_records('message_working', array('unreadmessageid' => $messageid)) == 0) {
             if (insert_record('message_read', $message)) {
                 delete_records('message', 'id', $messageid);
             }
         }
     } else {
         //delete what we've processed and check if can move message
         if (count_records('message_working', 'unreadmessageid', $messageid) == 0) {
             if (insert_record('message_read', $message)) {
                 delete_records('message', 'id', $messageid);
             }
         }
     }
     return true;
 }
开发者ID:remotelearner,项目名称:elis.cm,代码行数:37,代码来源:message_output_email.php


示例8: send_message

    /**
     * Processes the message (sends by email).
     * @param object $eventdata the event data submitted by the message sender plus $eventdata->savedmessageid
     */
    function send_message($eventdata) {
        global $CFG;

        if (!empty($CFG->noemailever)) {
            // hidden setting for development sites, set in config.php if needed
            debugging('$CFG->noemailever active, no email message sent.', DEBUG_MINIMAL);
            return true;
        }

        // skip any messaging suspended and deleted users
        if ($eventdata->userto->auth === 'nologin' or $eventdata->userto->suspended or $eventdata->userto->deleted) {
            return true;
        }

        //the user the email is going to
        $recipient = null;

        //check if the recipient has a different email address specified in their messaging preferences Vs their user profile
        $emailmessagingpreference = get_user_preferences('message_processor_email_email', null, $eventdata->userto);
        $emailmessagingpreference = clean_param($emailmessagingpreference, PARAM_EMAIL);

        // If the recipient has set an email address in their preferences use that instead of the one in their profile
        // but only if overriding the notification email address is allowed
        if (!empty($emailmessagingpreference) && !empty($CFG->messagingallowemailoverride)) {
            //clone to avoid altering the actual user object
            $recipient = clone($eventdata->userto);
            $recipient->email = $emailmessagingpreference;
        } else {
            $recipient = $eventdata->userto;
        }
        $result = email_to_user($recipient, $eventdata->userfrom, $eventdata->subject, $eventdata->fullmessage, $eventdata->fullmessagehtml);

        return $result;
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:38,代码来源:message_output_email.php


示例9: notify

 function notify($changelist, $user, $course)
 {
     $html_message = $this->html_mail($changelist, $course);
     $text_message = $this->text_mail($changelist, $course);
     $subject = get_string('mailsubject', 'block_moodle_notifications');
     $subject .= ": " . format_string($course->fullname, true);
     email_to_user($user, '', $subject, $text_message, $html_message);
 }
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:8,代码来源:eMail.php


示例10: notify_admins_unknown

function notify_admins_unknown($file, $a)
{
    global $site;
    $admins = get_admins();
    $subject = get_string('virusfoundsubject', 'moodle', format_string($site->fullname));
    $body = get_string('virusfoundlateradminnolog', 'moodle', $a);
    foreach ($admins as $admin) {
        email_to_user($admin, $admin, $subject, $body);
    }
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:10,代码来源:handlevirus.php


示例11: notify

 function notify($changelist, $user, $course)
 {
     $admin = current(get_admins());
     $html_message = $this->html_mail($changelist, $course);
     $text_message = $this->text_mail($changelist, $course);
     $subject = get_string('mailsubject', 'block_notifications');
     $subject .= ": " . format_string($course->fullname, true);
     //$this->test_email_to_user( $user, $admin, $subject, $text_message, $html_message );
     email_to_user($user, $admin, $subject, $text_message, $html_message);
 }
开发者ID:rogiervandongen,项目名称:moodle_notifications_20,代码行数:10,代码来源:eMail.php


示例12: apply

 public function apply($discussion, $all, $selected, $formdata)
 {
     global $COURSE, $USER, $CFG;
     // Begin with standard text
     $a = (object) array('name' => fullname($USER, true));
     $allhtml = "<body id='forumng-email'>\n";
     $preface = get_string('forward_preface', 'forumngfeature_forward', $a);
     $allhtml .= $preface;
     $alltext = format_text_email($preface, FORMAT_HTML);
     // Include intro if specified
     if (!preg_match('~^(<br[^>]*>|<p>|</p>|\\s)*$~', $formdata->message['text'])) {
         $alltext .= "\n" . mod_forumng_cron::EMAIL_DIVIDER . "\n";
         $allhtml .= '<hr size="1" noshade="noshade" />';
         // Add intro
         $message = trusttext_strip($formdata->message['text']);
         $allhtml .= format_text($message, $formdata->message['format']);
         $alltext .= format_text_email($message, $formdata->message['format']);
     }
     // Get list of all post ids in discussion order
     $alltext .= "\n" . mod_forumng_cron::EMAIL_DIVIDER . "\n";
     $allhtml .= '<hr size="1" noshade="noshade" />';
     $poststext = '';
     $postshtml = '';
     $discussion->build_selected_posts_email($selected, $poststext, $postshtml);
     $alltext .= $poststext;
     $allhtml .= $postshtml . '</body>';
     $emails = preg_split('~[; ]+~', $formdata->email);
     $subject = $formdata->subject;
     foreach ($emails as $email) {
         $fakeuser = (object) array('email' => $email, 'mailformat' => 1, 'id' => -1);
         $from = $USER;
         $from->maildisplay = 999;
         // Nasty hack required for OU moodle
         if (!email_to_user($fakeuser, $from, $subject, $alltext, $allhtml)) {
             print_error('error_forwardemail', 'forumng', $discussion->get_moodle_url(), $formdata->email);
         }
     }
     // Log that it was sent
     $params = array('context' => $discussion->get_forum()->get_context(), 'objectid' => $discussion->get_id(), 'other' => array('logurl' => $discussion->get_log_url(), 'info' => $formdata->email));
     $event = \forumngfeature_forward\event\discussion_forwarded::create($params);
     $event->add_record_snapshot('course_modules', $discussion->get_course_module());
     $event->add_record_snapshot('course', $discussion->get_course());
     $event->trigger();
     if (!empty($formdata->ccme)) {
         if (!email_to_user($USER, $from, $subject, $alltext, $allhtml)) {
             print_error('error_forwardemail', 'forumng', $discussion->get_moodle_url(), $USER->email);
         }
     }
     $out = $discussion->init_page($discussion->get_moodle_url(), $this->get_page_name());
     print $out->header();
     print $out->box(get_string('forward_done', 'forumngfeature_forward'));
     print $out->continue_button(new moodle_url('/mod/forumng/discuss.php', $discussion->get_link_params_array()));
     print $out->footer();
 }
开发者ID:nadavkav,项目名称:moodle-mod_forumng,代码行数:54,代码来源:forward.php


示例13: apply

 function apply($discussion, $all, $selected, $formdata)
 {
     global $COURSE, $USER, $CFG;
     // Begin with standard text
     $a = (object) array('name' => fullname($USER, true));
     $allhtml = "<head>";
     foreach ($CFG->stylesheets as $stylesheet) {
         $allhtml .= '<link rel="stylesheet" type="text/css" href="' . $stylesheet . '" />' . "\n";
     }
     $allhtml .= "</head>\n<body id='forumng-email'>\n";
     $preface = get_string('forward_preface', 'forumng', $a);
     $allhtml .= $preface;
     $alltext = format_text_email($preface, FORMAT_HTML);
     // Include intro if specified
     if (!preg_match('~^(<br[^>]*>|<p>|</p>|\\s)*$~', $formdata->message)) {
         $alltext .= "\n" . forum_cron::EMAIL_DIVIDER . "\n";
         $allhtml .= '<hr size="1" noshade="noshade" />';
         // Add intro
         $message = trusttext_strip(stripslashes($formdata->message));
         $allhtml .= format_text($message, $formdata->format);
         $alltext .= format_text_email($message, $formdata->format);
     }
     // Get list of all post ids in discussion order
     $alltext .= "\n" . forum_cron::EMAIL_DIVIDER . "\n";
     $allhtml .= '<hr size="1" noshade="noshade" />';
     $poststext = '';
     $postshtml = '';
     $discussion->build_selected_posts_email($selected, $poststext, $postshtml);
     $alltext .= $poststext;
     $allhtml .= $postshtml . '</body>';
     $emails = preg_split('~[; ]+~', $formdata->email);
     $subject = stripslashes($formdata->subject);
     foreach ($emails as $email) {
         $fakeuser = (object) array('email' => $email, 'mailformat' => 1, 'id' => 0);
         $from = $USER;
         $from->maildisplay = 999;
         // Nasty hack required for OU moodle
         if (!email_to_user($fakeuser, $from, $subject, $alltext, $allhtml)) {
             print_error('error_forwardemail', 'forumng', $formdata->email);
         }
     }
     // Log that it was sent
     $discussion->log('forward discussion', $formdata->email);
     if (!empty($formdata->ccme)) {
         if (!email_to_user($USER, $from, $subject, $alltext, $allhtml)) {
             print_error('error_forwardemail', 'forumng', $USER->email);
         }
     }
     $discussion->print_subpage_header($this->get_page_name());
     print_box(get_string('forward_done', 'forumng'));
     print_continue('../../discuss.php?' . $discussion->get_link_params(forum::PARAM_PLAIN));
     print_footer($COURSE);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:53,代码来源:forward.php


示例14: sendMail

 /**
  * Send's an anonymous email to some address, preferably the Mediabird team or a user
  * @param $to Id of user to which to deliver email
  * @param $subject Subject of email
  * @param $body Body of email
  * @return bool Success
  */
 function sendMail($to, $subject, $body)
 {
     if ($to == -1) {
         return false;
     }
     if ($account_link = get_record("studynotes_account_links", "system", "moodle", "internal_id", $to)) {
         if ($destination = get_record("user", "id", $account_link->external_id)) {
             $supportuser = generate_email_supportuser();
             return email_to_user($destination, $supportuser, $subject, $body);
         }
     }
     return false;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:20,代码来源:moodle_auth.php


示例15: mailToUser

 /**
  *
  * @param stdClass $user  A {@link $USER} object
  * @param stdClass $user  A {@link $USER} object
  */
 public function mailToUser($userto, $userfrom)
 {
     $html = $this->makeMailHtml($this->html, $userto);
     $plain = $this->makeMailText($this->plain, $userto);
     $site = get_site();
     $subject = format_string($site->shortname) . ": " . $this->subject;
     $result = email_to_user($userto, $userfrom, $subject, $plain, $html);
     if ($result === true) {
         return true;
     }
     //$this->error .= "<div>".var_dump($result, true)."</div>";
     return false;
 }
开发者ID:jerab,项目名称:moodle-mod-praxe,代码行数:18,代码来源:mailing.php


示例16: send_message

 /**
  * Processes the message (sends by email).
  * @param object $eventdata the event data submitted by the message sender plus $eventdata->savedmessageid
  */
 function send_message($eventdata)
 {
     global $CFG;
     // Ignore $CFG->noemailever here because we want to test this code,
     // the message sending fails later in email_to_user().
     // skip any messaging suspended and deleted users
     if ($eventdata->userto->auth === 'nologin' or $eventdata->userto->suspended or $eventdata->userto->deleted) {
         return true;
     }
     //the user the email is going to
     $recipient = null;
     //check if the recipient has a different email address specified in their messaging preferences Vs their user profile
     $emailmessagingpreference = get_user_preferences('message_processor_email_email', null, $eventdata->userto);
     $emailmessagingpreference = clean_param($emailmessagingpreference, PARAM_EMAIL);
     // If the recipient has set an email address in their preferences use that instead of the one in their profile
     // but only if overriding the notification email address is allowed
     if (!empty($emailmessagingpreference) && !empty($CFG->messagingallowemailoverride)) {
         //clone to avoid altering the actual user object
         $recipient = clone $eventdata->userto;
         $recipient->email = $emailmessagingpreference;
     } else {
         $recipient = $eventdata->userto;
     }
     // Check if we have attachments to send.
     $attachment = '';
     $attachname = '';
     if (!empty($CFG->allowattachments) && !empty($eventdata->attachment)) {
         if (empty($eventdata->attachname)) {
             // Attachment needs a file name.
             debugging('Attachments should have a file name. No attachments have been sent.', DEBUG_DEVELOPER);
         } else {
             if (!$eventdata->attachment instanceof stored_file) {
                 // Attachment should be of a type stored_file.
                 debugging('Attachments should be of type stored_file. No attachments have been sent.', DEBUG_DEVELOPER);
             } else {
                 // Copy attachment file to a temporary directory and get the file path.
                 $attachment = $eventdata->attachment->copy_content_to_temp();
                 // Get attachment file name.
                 $attachname = clean_filename($eventdata->attachname);
             }
         }
     }
     $result = email_to_user($recipient, $eventdata->userfrom, $eventdata->subject, $eventdata->fullmessage, $eventdata->fullmessagehtml, $attachment, $attachname);
     // Remove an attachment file if any.
     if (!empty($attachment) && file_exists($attachment)) {
         unlink($attachment);
     }
     return $result;
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:53,代码来源:message_output_email.php


示例17: send_welcome

/**
 * This plugin sends users a welcome message after logging in
 * and notify a moderator a new user has been added
 * it has a settings page that allow you to configure the messages
 * send.
 *
 * @package    local
 * @subpackage welcome
 * @copyright  2014 Bas Brands, basbrands.nl, [email protected]
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
function send_welcome($user)
{
    global $CFG, $SITE;
    $moderator = get_admin();
    $sender = get_admin();
    if (!empty($user->email)) {
        $config = get_config('local_welcome');
        if (!empty($config->auth_plugins)) {
            $auths = explode(',', $config->auth_plugins);
            if (!in_array($user->auth, $auths)) {
                return '';
            }
        } else {
            return '';
        }
        $moderator->email = $config->moderator_email;
        $sender->email = $config->sender_email;
        $sender->firstname = $config->sender_firstname;
        $sender->lastname = $config->sender_lastname;
        $message_user_enabled = $config->message_user_enabled;
        $message_user = $config->message_user;
        $message_user_subject = $config->message_user_subject;
        $message_moderator_enabled = $config->message_moderator_enabled;
        $message_moderator = $config->message_moderator;
        $message_moderator_subject = $config->message_moderator_subject;
        if (!empty($user->country)) {
            $user->country = get_string($user->country, 'countries');
        } else {
            $user->country = '';
        }
        $sitelink = html_writer::link(new moodle_url('/'), $SITE->fullname);
        $resetpasswordlink = html_writer::link(new moodle_url('/login/forgot_password.php'), get_string('resetpass', 'local_welcome'));
        $fields = array('[[fullname]]', '[[username]]', '[[firstname]]', '[[lastname]]', '[[email]]', '[[city]]', '[[country]]', '[[sitelink]]', '[[sitename]]', '[[resetpasswordlink]]');
        $values = array(fullname($user), $user->username, $user->firstname, $user->lastname, $user->email, $user->city, $user->country, $sitelink, $SITE->fullname, $resetpasswordlink);
        $message_user = str_replace($fields, $values, $message_user);
        $message_user_subject = str_replace($fields, $values, $message_user_subject);
        $message_moderator = str_replace($fields, $values, $message_moderator);
        $message_moderator_subject = str_replace($fields, $values, $message_moderator_subject);
        if (!empty($message_user) && !empty($sender->email) && $message_user_enabled) {
            email_to_user($user, $sender, $message_user_subject, html_to_text($message_user), $message_user);
        }
        if (!empty($message_moderator) && !empty($sender->email) && $message_moderator_enabled) {
            email_to_user($moderator, $sender, $message_moderator_subject, html_to_text($message_moderator), $message_moderator);
        }
    }
}
开发者ID:RicardoMaurici,项目名称:moodle-local_welcome,代码行数:57,代码来源:event_handlers.php


示例18: php_report_schedule_export_instance

/**
 * Runs and exports, through email, the report instance specified by the
 * provided report schedule
 *
 * @param   stdClass  $report_schedule  The PHP report schedule containing the information
 *                                      about the specific report to be exported
 *
 * @return  boolean                     true on success, otherwise false
 */
function php_report_schedule_export_instance($report_schedule, $now = 0)
{
    global $CFG;
    if ($now == 0) {
        $now = gmmktime();
        // time();
    }
    $data = unserialize($report_schedule->config);
    // Create report to be emailed to recipient
    $shortname = $report_schedule->report;
    $format = $data['format'];
    // Initialize a temp path name
    $tmppath = '/temp';
    // Create a unique temporary filename to use for this schedule
    $filename = tempnam($CFG->dataroot . $tmppath, 'php_report_');
    $parameterdata = $data['parameters'];
    // Generate the report file
    $result = php_report::export_default_instance($shortname, $format, $filename, $parameterdata, $report_schedule->userid, php_report::EXECUTION_MODE_SCHEDULED);
    if (!$result) {
        //handle failure case
        unlink($filename);
        return false;
    }
    // Attach filename to an email - so get recipient...
    $recipients_array = explode(',', $data['recipients']);
    $from = get_string('noreplyname');
    $subject = get_string('email_subject', 'block_php_report') . $data['label'];
    $messagetext = html_to_text($data['message']);
    $messagehtml = $data['message'];
    $start = strlen($CFG->dataroot);
    $attachment = substr($filename, $start);
    $attachname = $report_schedule->report . $now . '.' . $data['format'];
    // Attach the file to the recipients
    foreach ($recipients_array as $recipient) {
        $user = new stdClass();
        $user->email = $recipient;
        $user->mailformat = 1;
        email_to_user($user, $from, $subject, $messagetext, $messagehtml, $attachment, $attachname);
    }
    // Remove the file that was created for this report
    unlink($filename);
    return true;
}
开发者ID:remotelearner,项目名称:elis.reporting,代码行数:52,代码来源:runschedule.php


示例19: send_batch_activiation

function send_batch_activiation($f2fid){
    global $DB;
$batchuser=$DB->get_records('local_batch_users',array('f2fid'=>$f2fid));
//print_object($batchuser);
    foreach($batchuser as $batchusers){
	   $sessions=getsession_list($f2fid);
           $subject='Active Notification';
           $messagetext = get_string('batchactivemessage', 'facetoface');
           $messagetext .=$sessions;
           $messagehtml = text_to_html($messagetext, null, false, true);
        // echo $sessions;
         $user=$DB->get_record('user',array('id'=>$batchusers->userid));

         $from = $DB->get_record('user',array('id'=>2));
echo $messagehtml;
      $sent=   email_to_user($user, $from, $subject, $messagetext, $messagehtml);
echo "mail sent";
    }

}
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:20,代码来源:myreports.php


示例20: run

 function run()
 {
     $notificationdays = get_config('block_ilp', 'deadlinenotification');
     if (!empty($notificationdays)) {
         $lowertimestamp = mktime(0, 0, 0, date('n'), date('j') + $notificationdays);
         $uppertimestamp = mktime(23, 59, 59, date('n'), date('j') + $notificationdays);
         $reportentries = $this->get_list($lowertimestamp, $uppertimestamp);
         mtrace("running cron");
         foreach ($reportentries as $r) {
             mtrace($r->name);
             $user = $this->dbc->get_user_by_id($r->user_id);
             mtrace($user->firstname);
             $email = new stdClass();
             $email->reportname = $r->name;
             $email->firsttname = $user->firstname;
             $email->lasttname = $user->lastname;
             $email->deadline = userdate($r->deadline);
             $subject = get_string('cronemailsubject', 'block_ilp', $email);
             $messagetext = get_string('cronemailhtml', 'block_ilp', $email);
             email_to_user($user, get_string('cronemailsender', 'block_ilp'), $subject, $messagetext);
         }
     }
 }
开发者ID:nathanfriend,项目名称:moodle-block_ilp,代码行数:23,代码来源:ilp_cron.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP email_user函数代码示例发布时间:2022-05-15
下一篇:
PHP email_store函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap