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


PHP elgg_send_email函数代码示例

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


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

示例1: river_activity_3C_bday_mailer

function river_activity_3C_bday_mailer($hook, $entity_type, $returnvalue, $params)
{
    $bday = elgg_get_plugin_setting('birth_day', 'river_activity_3C');
    elgg_set_ignore_access(true);
    $siteurl = elgg_get_site_entity()->url;
    $sitename = elgg_get_site_entity()->name;
    $siteemail = elgg_get_site_entity()->email;
    $from = $sitename . ' <' . $siteemail . '>';
    $month = date('m', strtotime("now"));
    $options = array('metadata_names' => 'BD_month', 'metadata_values' => $month, 'types' => 'user', 'limit' => false, 'full_view' => false, 'pagination' => false);
    $bd_users = new ElggBatch('elgg_get_entities_from_metadata', $options);
    $bd_today = date('j, F', strtotime('now'));
    foreach ($bd_users as $bd_user) {
        $bd_name = $bd_user->name;
        $bd_email = $bd_user->email;
        $bd_day = date('j, F', strtotime($bd_user->{$bday}));
        if ($bd_day == $bd_today) {
            if ($bd_email) {
                $message = elgg_echo('river_activity_3C:bday_message', array($bd_name, $bd_day, $sitename, $siteurl));
                elgg_send_email($from, $bd_email, elgg_echo('river_activity_3C:bday_message:subject'), $message);
                $result = elgg_echo("river_activity_3C:bday_mailer_cron_true");
            } else {
                $result = elgg_echo("river_activity_3C:bday_mailer_cron_false");
            }
        }
    }
    elgg_set_ignore_access(false);
    return $returnvalue . $result;
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:29,代码来源:river_activity_3C.php

示例2: testElggSendEmailBypass

 function testElggSendEmailBypass()
 {
     _elgg_services()->hooks->registerHandler('email', 'system', [$this, 'handleEmailHookTrue']);
     $this->assertTrue(elgg_send_email("from@elgg.org", "to@elgg.org", "Hello", "World", ['foo' => 1]));
     _elgg_services()->hooks->unregisterHandler('email', 'system', [$this, 'handleEmailHookTrue']);
     $this->assertNull($this->mailer->getLastMessage());
 }
开发者ID:elgg,项目名称:elgg,代码行数:7,代码来源:MailerTest.php

示例3: elgg_update_services_notify_admin

function elgg_update_services_notify_admin($message)
{
    $site = elgg_get_site_entity();
    if ($site && isset($site->email)) {
        $mailfrom = $site->email;
    } else {
        $mailfrom = 'noreply@' . $site->getDomain();
    }
    $mailto = elgg_get_plugin_setting("notify_mail_address", 'elgg_update_services');
    if ($mailto) {
        elgg_send_email($mailfrom, $mailto, elgg_echo('elgg_update_services:subject'), $message);
    }
}
开发者ID:iionly,项目名称:elgg_update_services,代码行数:13,代码来源:start.php

示例4: spam_login_filter_notify_admin

function spam_login_filter_notify_admin($blockedEmail, $blockedIp, $reason)
{
    if (elgg_get_plugin_setting('notify_by_mail', 'spam_login_filter') == "yes") {
        //Notify spam tentative to administrator
        $site = elgg_get_site_entity();
        if ($site && isset($site->email)) {
            $from = $site->email;
        } else {
            $from = 'noreply@' . get_site_domain($site->guid);
        }
        $message = sprintf(elgg_echo('spam_login_filter:notify_message'), $blockedEmail, $blockedIp, $reason);
        $to = elgg_get_plugin_setting('notify_mail_address', 'spam_login_filter');
        if (!is_email_address($to)) {
            return;
        }
        elgg_send_email($from, $to, elgg_echo('spam_login_filter:notify_subject'), $message);
    }
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:18,代码来源:start.php

示例5: uservalidationbyadmin_request_validation

/**
 * Request user validation email.
 * Send email out to the address and request a confirmation.
 *
 * @param int  $user_guid       The user's GUID
 * @param bool $admin_requested Was it requested by admin
 * @return mixed
 */
function uservalidationbyadmin_request_validation($user_guid, $admin_requested = FALSE)
{
    $site = elgg_get_site_entity();
    if ($site && $site->email) {
        $from = $site->email;
    } else {
        $from = 'noreply@' . get_site_domain($site->guid);
    }
    $user_guid = (int) $user_guid;
    $user = get_entity($user_guid);
    //notify admins
    if ($user && $user instanceof ElggUser) {
        // Work out validate link
        $code = uservalidationbyadmin_generate_code($user_guid, $user->email);
        $link = "{$site->url}uservalidationbyadmin/confirm?u={$user_guid}&c={$code}";
        // IP detection
        $ip_address = $_SERVER['REMOTE_ADDR'];
        /*$geoloc = "https://secure.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress=".$ip_address;
        		$geotags = get_meta_tags($geoloc);
        		$geocountry = $geotags['country'];
        		$georegion = $geotags['region'];
        		$geocity = $geotags['city'];
        		$geocertainty = $geotags['certainty'];*/
        $geostring = $ip_address;
        //." ; ".$geocountry." ; ".$georegion." ; ".$geocity." ; ".$geocertainty;
        // Send validation email
        $subject = elgg_echo('email:validate:subject', array($user->name, $site->name));
        $body = elgg_echo('email:validate:body', array($user->name, $user->email, $ip_address, $geostring, $link, $site->name, $site->url));
        $emails = elgg_get_plugin_setting('emails', 'uservalidationbyadmin');
        $admin_mails = explode(",", $emails);
        $sent_total = 0;
        foreach ($admin_mails as $mail) {
            if (elgg_send_email($from, $mail, $subject, $body)) {
                $sent_total++;
            }
        }
        // Atleast 1 mail sent
        if ($sent_total > 0 && !$admin_requested) {
            system_message(elgg_echo('uservalidationbyadmin:registerok'));
        }
        return $result;
    }
    return FALSE;
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:52,代码来源:functions.php

示例6: send_user_password_mail

/**
 * Send password for new user who is registered using facebook connect
 *
 * @param $email
 * @param $name
 * @param $username
 * @param $password
 */
function send_user_password_mail($email, $name, $username, $password)
{
    $site = elgg_get_site_entity();
    $email = trim($email);
    // send out other email addresses
    if (!is_email_address($email)) {
        return false;
    }
    $message = elgg_echo('facebook_connect:email:body', array($name, $site->name, $site->url, $username, $email, $password, $site->name, $site->url));
    $subject = elgg_echo('facebook_connect:email:subject', array($name));
    // create the from address
    $site = get_entity($site->guid);
    if ($site && isset($site->email)) {
        $from = $site->email;
    } else {
        $from = 'noreply@' . get_site_domain($site->guid);
    }
    elgg_send_email($from, $email, $subject, $message);
}
开发者ID:duanhv,项目名称:mdg-social,代码行数:27,代码来源:start.php

示例7: group_tools_invite_email

function group_tools_invite_email(ElggGroup $group, $email, $text = "", $resend = false)
{
    $result = false;
    if (!empty($group) && $group instanceof ElggGroup && !empty($email) && is_email_address($email) && ($loggedin_user = elgg_get_logged_in_user_entity())) {
        // get site secret
        $site_secret = get_site_secret();
        // generate invite code
        $invite_code = md5($site_secret . $email . $group->getGUID());
        if (!group_tools_check_group_email_invitation($invite_code, $group->getGUID()) || $resend) {
            // make site email
            $site = elgg_get_site_entity();
            if (!empty($site->email)) {
                if (!empty($site->name)) {
                    $site_from = $site->name . " <" . $site->email . ">";
                } else {
                    $site_from = $site->email;
                }
            } else {
                // no site email, so make one up
                if (!empty($site->name)) {
                    $site_from = $site->name . " <noreply@" . get_site_domain($site->getGUID()) . ">";
                } else {
                    $site_from = "noreply@" . get_site_domain($site->getGUID());
                }
            }
            if (!$resend) {
                // register invite with group
                $group->annotate("email_invitation", $invite_code, ACCESS_LOGGED_IN, $group->getGUID());
            }
            // make subject
            $subject = elgg_echo("group_tools:groups:invite:email:subject", array($group->name));
            // make body
            $body = elgg_echo("group_tools:groups:invite:email:body", array($loggedin_user->name, $group->name, $site->name, $text, $site->name, elgg_get_site_url() . "register", elgg_get_site_url() . "groups/invitations/?invitecode=" . $invite_code, $invite_code));
            $result = elgg_send_email($site_from, $email, $subject, $body);
        } else {
            $result = null;
        }
    }
    return $result;
}
开发者ID:remy40,项目名称:gvrs,代码行数:40,代码来源:functions.php

示例8: create_annotation

         continue;
     }
     if ($user->guid == elgg_get_logged_in_user_guid()) {
         $error++;
         continue;
     }
     if ($user->isBanned()) {
         $banned++;
     } else {
         if ($user->ban(get_input('approval_message', 'admin decision'))) {
             create_annotation($user->guid, 'ban', get_input('approval_message', true), '', elgg_get_logged_in_user_guid(), ACCESS_PUBLIC);
             $subject = elgg_echo("db_explorer:ban:email:subject");
             if (get_input('notify_users', false)) {
                 $body = elgg_view('framework/db_explorer/notifications/ban', array('entity' => $user, 'setter' => elgg_get_logged_in_user_entity(), 'note' => get_input('notify_users_message')));
                 try {
                     elgg_send_email(elgg_get_site_entity()->email, $user->email, $subject, $body);
                 } catch (Exception $e) {
                     register_error($e->getMessage());
                 }
             }
             $success++;
         } else {
             $error++;
         }
     }
 }
 $msg[] = elgg_echo('db_explorer:success:ban', array((int) $success, $count));
 if ($banned > 0) {
     $msg[] = elgg_echo('db_explorer:error:already_banned', array($banned));
 }
 if ($error_nouser > 0) {
开发者ID:hypejunction,项目名称:hypedbexplorer,代码行数:31,代码来源:ban.php

示例9: get_input

<?php

/**
 * Send verification email to user
 *
*/
$guids = get_input('user_guids');
//$guid = $guid[0];
//get the unvalidated user
access_show_hidden_entities(TRUE);
foreach ($guids as $guid) {
    $user = get_entity($guid);
    if ($user) {
        $code = uservalidationbyadmin_generate_code($user->guid, $user->email);
        $validate = elgg_view('output/confirmlink', array('confirm' => elgg_echo('uservalidationbyadmin:confirm_validate_user', array($user->username)), 'href' => "uservalidationbyadmin/validate?user_guids[]={$user->guid}&code={$code}", 'text' => elgg_echo('uservalidationbyadmin:admin:validate')));
        $validateLink = array_pop(explode('href=', $validate));
        $index = strpos($validateLink, 'rel=') - 3;
        $validateLink = substr($validateLink, 1, $index);
        //build validation email
        $subject = elgg_echo('uservalidationbyadmin:email:validate:header');
        $body = elgg_echo('uservalidationbyadmin:email:validate:body');
        $body .= "\r\n" . $validateLink;
        $options = array("to" => $to, "subject" => $subject, "html_message" => $body, "plaintext_message" => $body);
        if (elgg_send_email('no-reply@lp-pa.forces.gc.ca', $user->email, $subject, $body)) {
            system_message(elgg_echo('uservalidationbyadmin:email:validate:sent'));
        } else {
            register_error(elgg_echo('uservalidationbyadmin:email:validate:error'));
        }
    }
}
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:30,代码来源:email.php

示例10: sendEmail

 public function sendEmail($action, $email, $guid)
 {
     switch ($action) {
         case 'activate':
             $email = sanitise_string($email);
             $user = get_entity($guid);
             if (!$user) {
                 register_error(elgg_echo('email:activate:userNotFound'));
                 return false;
             }
             if (!$user->deactivated) {
                 register_error(elgg_echo('email:activate:userActivated'));
                 return false;
             }
             if (!$this->validateEmail($email)) {
                 register_error(elgg_echo('email:activate:invalidEmail'));
                 return false;
             }
             //construct the email
             $from = "no-reply@lp-pa.forces.gc.ca";
             $to = $email;
             $subject = elgg_echo('activate:heading');
             $code = $this->generateCode($user->guid, $email, date('Ymd'));
             $link = "{$this->site->url}usermgmt/activation?u={$user->guid}&c={$code}";
             $message = elgg_echo('email:activate:body', array($user->name, $link, $this->site->name, $this->{$site}->url));
             if (elgg_send_email($from, $to, $subject, $message)) {
                 return true;
             }
             register_error(elgg_echo('email:activate:error'));
             return false;
             break;
     }
 }
开发者ID:amcfarlane1251,项目名称:ongarde,代码行数:33,代码来源:UserManagement.php

示例11: register_error

    register_error(elgg_echo('registration:notemail'));
    forward(REFERER);
}
// try to find a registration
$registrations = elgg_get_entities_from_metadata(['type' => 'object', 'subtype' => EventRegistration::SUBTYPE, 'owner_guid' => $entity->getGUID(), 'limit' => 1, 'metadata_name_value_pairs' => ['name' => 'email', 'value' => $email, 'case_sensitive' => false]]);
if (empty($registrations)) {
    register_error(elgg_echo('event_manager:action:unsubscribe:error:no_registration'));
    forward(REFERER);
}
$registration = $registrations[0];
// generate unsubscribe code
$unsubscribe_code = event_manager_create_unsubscribe_code($registration, $entity);
$unsubscribe_link = elgg_normalize_url("events/unsubscribe/confirm/{$registration->getGUID()}/" . $unsubscribe_code);
// make a message with further instructions
$subject = elgg_echo('event_manager:unsubscribe:confirm:subject', [$entity->title]);
$message = elgg_echo('event_manager:unsubscribe:confirm:message', [$registration->name, $entity->title, $entity->getURL(), $unsubscribe_link]);
// nice e-mail addresses
$site = elgg_get_site_entity();
if ($site->email) {
    $from = $site->name . " <{$site->email}>";
} else {
    $from = $site->name . " <noreply@{$site->getDomain()}>";
}
$to = $registration->name . " <{$registration->email}>";
if (!elgg_send_email($from, $to, $subject, $message)) {
    register_error(elgg_echo('event_manager:action:unsubscribe:error:mail'));
    forward(REFERER);
}
elgg_clear_sticky_form('event_unsubscribe');
system_message(elgg_echo('event_manager:action:unsubscribe:success'));
forward($entity->getURL());
开发者ID:coldtrick,项目名称:event_manager,代码行数:31,代码来源:unsubscribe.php

示例12: event_manager_send_registration_validation_email

/**
 * Send registration validation email
 * 
 * @param Event      $event  event
 * @param ElggEntity $entity object or user to send mail to
 * 
 * @return void
 */
function event_manager_send_registration_validation_email(Event $event, ElggEntity $entity)
{
    $subject = elgg_echo("event_manager:registration:confirm:subject", array($event->title));
    $message = elgg_echo("event_manager:registration:confirm:message", array($entity->name, $event->title, event_manager_get_registration_validation_url($event->getGUID(), $entity->getGUID())));
    $site = elgg_get_site_entity();
    // send confirmation mail
    if (elgg_instanceof($entity, "user")) {
        notify_user($entity->getGUID(), $event->getOwnerGUID(), $subject, $message, null, "email");
    } else {
        $from = $site->email;
        if (empty($from)) {
            $from = "noreply@" . $site->getDomain();
        }
        if (!empty($site->name)) {
            $site_name = $site->name;
            if (strstr($site_name, ',')) {
                $site_name = '"' . $site_name . '"';
                // Protect the name with quotations if it contains a comma
            }
            $site_name = '=?UTF-8?B?' . base64_encode($site_name) . '?=';
            // Encode the name. If may content nos ASCII chars.
            $from = $site_name . " <" . $from . ">";
        }
        elgg_send_email($from, $entity->email, $subject, $message);
    }
}
开发者ID:pleio,项目名称:event_manager,代码行数:34,代码来源:functions.php

示例13: notifyOnRsvp

 /**
  * Notifies an user of the RSVP
  *
  * @param string $type type of the RSVP
  * @param string $to   guid of the user
  *
  * @return void
  */
 public function notifyOnRsvp($type, $to = null)
 {
     $ia = elgg_set_ignore_access(true);
     if ($to === null) {
         $to = elgg_get_logged_in_user_guid();
     }
     $to_entity = get_entity($to);
     if (empty($to_entity)) {
         elgg_set_ignore_access($ia);
         return;
     }
     // can we make nice links in the emails
     $html_email_handler_enabled = elgg_is_active_plugin("html_email_handler");
     // do we have a registration link
     $registrationLink = "";
     $unsubscribeLink = "";
     if ($type == EVENT_MANAGER_RELATION_ATTENDING) {
         if ($this->registration_needed) {
             $link = elgg_get_site_url() . 'events/registration/view/?guid=' . $this->getGUID() . '&u_g=' . $to . '&k=' . md5($this->time_created . get_site_secret() . $to);
             $registrationLink = PHP_EOL . PHP_EOL;
             $registrationLink .= elgg_echo('event_manager:event:registration:notification:program:linktext');
             $registrationLink .= PHP_EOL . PHP_EOL;
             if ($html_email_handler_enabled) {
                 $registrationLink .= elgg_view("output/url", array("text" => $link, "href" => $link));
             } else {
                 $registrationLink .= $link;
             }
         }
         if ($this->register_nologin) {
             $link = elgg_get_site_url() . "events/unsubscribe/" . $this->getGUID() . "/" . elgg_get_friendly_title($this->title) . "?e=" . $to_entity->email;
             $unsubscribeLink = PHP_EOL . PHP_EOL;
             $unsubscribeLink .= elgg_echo('event_manager:event:registration:notification:unsubscribe:linktext');
             $unsubscribeLink .= PHP_EOL . PHP_EOL;
             if ($html_email_handler_enabled) {
                 $unsubscribeLink .= elgg_view("output/url", array("text" => $link, "href" => $link));
             } else {
                 $unsubscribeLink .= $link;
             }
         }
     }
     // make the event title for in the e-mail
     if ($html_email_handler_enabled) {
         $event_title_link = elgg_view("output/url", array("text" => $this->title, "href" => $this->getURL()));
     } else {
         $event_title_link = $this->title;
     }
     // notify the owner of the event
     $this->notifyOwnerOnRSVP($type, $to_entity, $event_title_link, $registrationLink);
     // notify the attending user
     $user_subject = elgg_echo('event_manager:event:registration:notification:user:subject');
     $user_message = elgg_echo('event_manager:event:registration:notification:user:text:' . $type, array($to_entity->name, $event_title_link));
     $user_message .= $registrationLink;
     $user_message .= $unsubscribeLink;
     if ($to_entity instanceof ElggUser) {
         // use notification system for real users
         notify_user($to, $this->getOwnerGUID(), $user_subject, $user_message);
     } else {
         // send e-mail for non users
         $to_email = $to_entity->name . "<" . $to_entity->email . ">";
         $site = elgg_get_site_entity($this->site_guid);
         if ($site->email) {
             if ($site->name) {
                 $site_from = $site->name . " <" . $site->email . ">";
             } else {
                 $site_from = $site->email;
             }
         } else {
             // no site email, so make one up
             if ($site->name) {
                 $site_from = $site->name . " <noreply@" . $site->getDomain() . ">";
             } else {
                 $site_from = "noreply@" . $site->getDomain();
             }
         }
         elgg_send_email($site_from, $to_email, $user_subject, $user_message);
     }
     elgg_set_ignore_access($ia);
 }
开发者ID:pleio,项目名称:event_manager,代码行数:86,代码来源:Event.php

示例14: send_

 public function send_($from, $to, $subject, $body)
 {
     return \elgg_send_email($from, $to, $subject, $body);
 }
开发者ID:ewinslow,项目名称:elgg-evan,代码行数:4,代码来源:ElggSender.php

示例15: group_tools_invite_email

/**
 * Invite a new user by email to a group
 *
 * @param ElggGroup $group  the group to be invited for
 * @param string    $email  the email address to be invited
 * @param string    $text   (optional) extra text in the invitation
 * @param boolean   $resend should existing invitations be resend
 *
 * @return boolean|NULL true is invited, false on failure, null when already send
 */
function group_tools_invite_email(ElggGroup $group, $email, $text = "", $resend = false)
{
    $result = false;
    $loggedin_user = elgg_get_logged_in_user_entity();
    if (!empty($group) && $group instanceof ElggGroup && !empty($email) && is_email_address($email) && !empty($loggedin_user)) {
        // generate invite code
        $invite_code = group_tools_generate_email_invite_code($group->getGUID(), $email);
        if (!empty($invite_code)) {
            $found_group = group_tools_check_group_email_invitation($invite_code, $group->getGUID());
            if (empty($found_group) || $resend) {
                // make site email
                $site = elgg_get_site_entity();
                if (!empty($site->email)) {
                    if (!empty($site->name)) {
                        $site_from = $site->name . " <" . $site->email . ">";
                    } else {
                        $site_from = $site->email;
                    }
                } else {
                    // no site email, so make one up
                    if (!empty($site->name)) {
                        $site_from = $site->name . " <noreply@" . get_site_domain($site->getGUID()) . ">";
                    } else {
                        $site_from = "noreply@" . get_site_domain($site->getGUID());
                    }
                }
                if (empty($found_group)) {
                    // register invite with group
                    $group->annotate("email_invitation", $invite_code . "|" . $email, ACCESS_LOGGED_IN, $group->getGUID());
                }
                // make subject
                $subject = elgg_echo("group_tools:groups:invite:email:subject", array($group->name));
                // make body
                $body = elgg_echo("group_tools:groups:invite:email:body", array($loggedin_user->name, $group->name, $site->name, $text, $site->name, elgg_get_site_url() . "register?group_invitecode=" . $invite_code, elgg_get_site_url() . "groups/invitations/?invitecode=" . $invite_code, $invite_code));
                $params = array("group" => $group, "inviter" => $loggedin_user, "invitee" => $email);
                $body = elgg_trigger_plugin_hook("invite_notification", "group_tools", $params, $body);
                $result = elgg_send_email($site_from, $email, $subject, $body);
            } else {
                $result = null;
            }
        }
    }
    return $result;
}
开发者ID:pleio,项目名称:group_tools,代码行数:54,代码来源:functions.php


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