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


PHP email_to_user函数代码示例

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


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


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