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


PHP mail_to_user函数代码示例

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


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

示例1: notifyBackupFile

 function notifyBackupFile($user, $fileName)
 {
     $fileUrl = File::url($fileName);
     $body = sprintf(_m("The backup file you requested is ready for download.\n\n" . "%s\n" . "Thanks for your time,\n", "%s\n"), $fileUrl, common_config('site', 'name'));
     $headers = _mail_prepare_headers('offlinebackup', $user->nickname, $user->nickname);
     mail_to_user($user, _('Backup file ready for download'), $body, $headers);
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:offlinebackupqueuehandler.php

示例2: notify

 /**
  * Do the actual notification
  *
  * @param class $from reminderer
  * @param class $to reminderee
  *
  * @return nothing
  */
 function notify($from, $to)
 {
     if ($to->id != $from->id) {
         if ($to->email) {
             // TODO
             common_switch_locale($to->language);
             // TRANS: Subject for 'reminder' notification email.
             // TRANS: %s is the sender.
             $subject = sprintf(_('%s would like to see you post on GNU social'), $from->nickname);
             $from_profile = $from->getProfile();
             // TRANS: Body for 'reminder' notification email.
             // TRANS: %1$s is the sender's long name, $2$s is the receiver's nickname,
             // TRANS: %3$s is a URL to post notices at.
             $body = sprintf(_("%1\$s (%2\$s) is wondering what you are up to " . "these days and is inviting you to post some news.\n\n" . "So let's hear from you :)\n\n" . "%3\$s\n\n" . "Don't reply to this email; it won't get to them."), $from_profile->getBestName(), $from->nickname, common_local_url('all', array('nickname' => $to->nickname))) . mail_footer_block();
             common_switch_locale();
             $headers = $this->mail_prepare_headers('nudge', $to->nickname, $from->nickname);
             return mail_to_user($to, $subject, $body, $headers);
         }
     }
 }
开发者ID:abjectio,项目名称:gs-staleAccounts,代码行数:28,代码来源:stalereminder.php

示例3: mail_notify_attn

/**
 * notify a user that they have received an "attn:" message AKA "@-reply"
 *
 * @param User   $user   The user who recevied the notice
 * @param Notice $notice The notice that was sent
 *
 * @return void
 */
function mail_notify_attn($user, $notice)
{
    if (!$user->email || !$user->emailnotifyattn) {
        return;
    }
    $sender = $notice->getProfile();
    if ($sender->id == $user->id) {
        return;
    }
    if (!$sender->hasRight(Right::EMAILONREPLY)) {
        return;
    }
    $bestname = $sender->getBestName();
    common_switch_locale($user->language);
    if ($notice->hasConversation()) {
        $conversationUrl = common_local_url('conversation', array('id' => $notice->conversation)) . '#notice-' . $notice->id;
        // TRANS: Line in @-reply notification e-mail. %s is conversation URL.
        $conversationEmailText = sprintf(_("The full conversation can be read here:\n\n" . "\t%s"), $conversationUrl) . "\n\n";
    } else {
        $conversationEmailText = '';
    }
    // TRANS: E-mail subject for notice notification.
    // TRANS: %1$s is the sending user's long name, %2$s is the adding user's nickname.
    $subject = sprintf(_('%1$s (@%2$s) sent a notice to your attention'), $bestname, $sender->nickname);
    // TRANS: Body of @-reply notification e-mail.
    // TRANS: %1$s is the sending user's long name, $2$s is the StatusNet sitename,
    // TRANS: %3$s is a URL to the notice, %4$s is the notice text,
    // TRANS: %5$s is a URL to the full conversion if it exists (otherwise empty),
    // TRANS: %6$s is a URL to reply to the notice, %7$s is a URL to all @-replied for the addressed user,
    // TRANS: %8$s is a URL to the addressed user's e-mail settings, %9$s is the sender's nickname.
    $body = sprintf(_("%1\$s (@%9\$s) just sent a notice to your attention (an '@-reply') on %2\$s.\n\n" . "The notice is here:\n\n" . "\t%3\$s\n\n" . "It reads:\n\n" . "\t%4\$s\n\n" . "%5\$s" . "You can reply back here:\n\n" . "\t%6\$s\n\n" . "The list of all @-replies for you here:\n\n" . "%7\$s\n\n" . "Faithfully yours,\n" . "%2\$s\n\n" . "P.S. You can turn off these email notifications here: %8\$s\n"), $bestname, common_config('site', 'name'), common_local_url('shownotice', array('notice' => $notice->id)), $notice->content, $conversationEmailText, common_local_url('newnotice', array('replyto' => $sender->nickname, 'inreplyto' => $notice->id)), common_local_url('replies', array('nickname' => $user->nickname)), common_local_url('emailsettings'), $sender->nickname);
    //%9
    $headers = _mail_prepare_headers('mention', $user->nickname, $sender->nickname);
    common_switch_locale();
    mail_to_user($user, $subject, $body, $headers);
}
开发者ID:microcosmx,项目名称:experiments,代码行数:44,代码来源:mail.php

示例4: mail_twitter_bridge_removed

/**
 * Send a mail message to notify a user that her Twitter bridge link
 * has stopped working, and therefore has been removed.  This can
 * happen when the user changes her Twitter password, or otherwise
 * revokes access.
 *
 * @param User $user   user whose Twitter bridge link has been removed
 *
 * @return boolean success flag
 */
function mail_twitter_bridge_removed($user)
{
    $profile = $user->getProfile();
    common_switch_locale($user->language);
    $subject = sprintf(_m('Your Twitter bridge has been disabled.'));
    $site_name = common_config('site', 'name');
    $body = sprintf(_m('Hi, %1$s. We\'re sorry to inform you that your ' . 'link to Twitter has been disabled. We no longer seem to have ' . 'permission to update your Twitter status. (Did you revoke ' . '%3$s\'s access?)' . "\n\n" . 'You can re-enable your Twitter bridge by visiting your ' . "Twitter settings page:\n\n\t%2\$s\n\n" . "Regards,\n%3\$s\n"), $profile->getBestName(), common_local_url('twittersettings'), common_config('site', 'name'));
    common_switch_locale();
    return mail_to_user($user, $subject, $body);
}
开发者ID:Br3nda,项目名称:StatusNet,代码行数:20,代码来源:twitter.php

示例5: mail_facebook_app_removed

/**
 * Send a mail message to notify a user that her Facebook Application
 * access has been removed.
 *
 * @param User $user   user whose Facebook app link has been removed
 *
 * @return boolean success flag
 */
function mail_facebook_app_removed($user)
{
    $profile = $user->getProfile();
    $site_name = common_config('site', 'name');
    common_switch_locale($user->language);
    $subject = sprintf(_m('Your %1$s Facebook application access has been disabled.', $site_name));
    $body = sprintf(_m("Hi, %1\$s. We're sorry to inform you that we are " . 'unable to update your Facebook status from %2$s, and have disabled ' . 'the Facebook application for your account. This may be because ' . 'you have removed the Facebook application\'s authorization, or ' . 'have deleted your Facebook account.  You can re-enable the ' . 'Facebook application and automatic status updating by ' . "re-installing the %2\$s Facebook application.\n\nRegards,\n\n%2\$s"), $user->nickname, $site_name);
    common_switch_locale();
    return mail_to_user($user, $subject, $body);
}
开发者ID:Br3nda,项目名称:StatusNet,代码行数:18,代码来源:facebookutil.php

示例6: mail_twitter_bridge_removed

/**
 * Send a mail message to notify a user that her Twitter bridge link
 * has stopped working, and therefore has been removed.  This can
 * happen when the user changes her Twitter password, or otherwise
 * revokes access.
 *
 * @param User $user   user whose Twitter bridge link has been removed
 *
 * @return boolean success flag
 */
function mail_twitter_bridge_removed($user)
{
    $profile = $user->getProfile();
    common_switch_locale($user->language);
    // TRANS: Mail subject after forwarding notices to Twitter has stopped working.
    $subject = sprintf(_m('Your Twitter bridge has been disabled'));
    $site_name = common_config('site', 'name');
    // TRANS: Mail body after forwarding notices to Twitter has stopped working.
    // TRANS: %1$ is the name of the user the mail is sent to, %2$s is a URL to the
    // TRANS: Twitter settings, %3$s is the StatusNet sitename.
    $body = sprintf(_m('Hi, %1$s. We\'re sorry to inform you that your ' . 'link to Twitter has been disabled. We no longer seem to have ' . 'permission to update your Twitter status. Did you maybe revoke ' . '%3$s\'s access?' . "\n\n" . 'You can re-enable your Twitter bridge by visiting your ' . "Twitter settings page:\n\n\t%2\$s\n\n" . "Regards,\n%3\$s"), $profile->getBestName(), common_local_url('twittersettings'), common_config('site', 'name'));
    common_switch_locale();
    return mail_to_user($user, $subject, $body);
}
开发者ID:Grasia,项目名称:bolotweet,代码行数:24,代码来源:twitter.php

示例7: create_and_ask

function create_and_ask($username, $password, $name, $mail, $device_id, $question_body, $musername, $to, $from, $extradata)
{
    if ($username != '') {
        $question_detail = login_and_ask($device_id, $username, $password, $question_body, $musername);
        #print_r ($question_detail);
        $data['link'] = $question_detail['question']['web_link'];
        $val = mail_to_user($musername, $to, $question_detail, $mail, $name, $from, $extradata);
        if ($val == true) {
            $data['message'] = 'sent';
            $data['success'] = $question_detail['success'];
        } else {
            $data['message'] = 'Email not sent. Frankly will send a notification to the user. You can view the question here ' . $question_detail['question']['web_link'];
            $data['success'] = false;
        }
        print json_encode($data);
    } else {
        $response_reg = register_user($device_id, $mail);
        if (isset($response_reg['message'])) {
            $data["message"] = $response_reg['message'];
            $data["success"] = false;
            print json_encode($data);
        } else {
            $token = $response_reg['access_token'];
            $username_asker = $response_reg['username'];
            $question_detail = ask_question($question_body, false, $musername, $device_id, $token);
            #print_r ($question_detail);
            $data['link'] = $question_detail['question']['web_link'];
            $val = mail_to_user($musername, $to, $question_detail, $mail, $name, $from, $extradata);
            if ($val == true) {
                $data['message'] = 'sent';
                $data['success'] = $question_detail['success'];
            } else {
                $data['message'] = 'Email not sent. Frankly will send a notification to the user. You can view the question here ' . $question_detail['question']['web_link'];
                $data['success'] = false;
            }
            print json_encode($data);
        }
    }
}
开发者ID:sjindal94,项目名称:frankly-wp-plugins,代码行数:39,代码来源:apicalls.php

示例8: exit

        } else {
            print "Faltan parámetros\n";
            exit(1);
        }
    }
}
// Si hemos llegado aquí es que hay usuario o grupo válido.
foreach ($members as $member) {
    $user = $member->getUser();
    if (empty($user->email)) {
        print "El usuario '{$user->nickname}' no tiene email registrado.\n";
    } else {
        $subject = "Esto es un asunto de ejemplo";
        $body = crearEmail($user, $confirm);
        print "Enviando correo a {$user->nickname}...";
        if (mail_to_user($user, $subject, $body)) {
            print " Enviado.\n";
            sleep(5);
        } else {
            print " Fallo.\n";
        }
    }
}
function body($user)
{
    // Creamos el correo personalizado
    $body = "Hola, {$user->nickname}.";
    $body .= "\n\n";
    $body .= "Bienvenido a " . common_config('site', 'name') . ".";
    $body .= "\n\n";
    $body .= "Escribe por aquí el contenido del mensaje. " . ($body .= "\n\n\n\n");
开发者ID:Grasia,项目名称:bolotweet,代码行数:31,代码来源:enviarEmail.php

示例9: recoverPassword

 static function recoverPassword($nore)
 {
     $user = User::staticGet('email', common_canonical_email($nore));
     if (!$user) {
         try {
             $user = User::staticGet('nickname', common_canonical_nickname($nore));
         } catch (NicknameException $e) {
             // invalid
         }
     }
     // See if it's an unconfirmed email address
     if (!$user) {
         // Warning: it may actually be legit to have multiple folks
         // who have claimed, but not yet confirmed, the same address.
         // We'll only send to the first one that comes up.
         $confirm_email = new Confirm_address();
         $confirm_email->address = common_canonical_email($nore);
         $confirm_email->address_type = 'email';
         $confirm_email->find();
         if ($confirm_email->fetch()) {
             $user = User::staticGet($confirm_email->user_id);
         } else {
             $confirm_email = null;
         }
     } else {
         $confirm_email = null;
     }
     if (!$user) {
         // TRANS: Information on password recovery form if no known username or e-mail address was specified.
         throw new ClientException(_('No user with that email address or username.'));
         return;
     }
     // Try to get an unconfirmed email address if they used a user name
     if (!$user->email && !$confirm_email) {
         $confirm_email = new Confirm_address();
         $confirm_email->user_id = $user->id;
         $confirm_email->address_type = 'email';
         $confirm_email->find();
         if (!$confirm_email->fetch()) {
             $confirm_email = null;
         }
     }
     if (!$user->email && !$confirm_email) {
         // TRANS: Client error displayed on password recovery form if a user does not have a registered e-mail address.
         throw new ClientException(_('No registered email address for that user.'));
         return;
     }
     // Success! We have a valid user and a confirmed or unconfirmed email address
     $confirm = new Confirm_address();
     $confirm->code = common_confirmation_code(128);
     $confirm->address_type = 'recover';
     $confirm->user_id = $user->id;
     $confirm->address = !empty($user->email) ? $user->email : $confirm_email->address;
     if (!$confirm->insert()) {
         common_log_db_error($confirm, 'INSERT', __FILE__);
         // TRANS: Server error displayed if e-mail address confirmation fails in the database on the password recovery form.
         throw new ServerException(_('Error saving address confirmation.'));
         return;
     }
     // @todo FIXME: needs i18n.
     $body = "Hola, {$user->nickname}.";
     $body .= "\n\n";
     $body .= 'Alguien ha solicitado una nueva contraseña ' . 'para esta cuenta en ' . common_config('site', 'name') . '.';
     $body .= "\n\n";
     $body .= 'Si has sido tú, y quieres modificarla, pulsa en el enlace de abajo:';
     $body .= "\n\n";
     $body .= "\t" . common_local_url('recoverpassword', array('code' => $confirm->code));
     $body .= "\n\n";
     $body .= 'Si no, puedes ignorar y eliminar este mensaje.';
     $body .= "\n\n";
     $body .= 'Gracias por tu tiempo, ';
     $body .= "\n";
     $body .= common_config('site', 'name');
     $body .= "\n";
     $headers = _mail_prepare_headers('recoverpassword', $user->nickname, $user->nickname);
     // TRANS: Subject for password recovery e-mail.
     mail_to_user($user, _('Solicitud de recuperación de contraseña'), $body, $headers, $confirm->address);
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:78,代码来源:User.php

示例10: emailWarn

 static function emailWarn($user)
 {
     $profile = $user->getProfile();
     $siteName = common_config('site', 'name');
     $siteEmail = common_config('site', 'email');
     if (empty($siteEmail)) {
         common_log(LOG_WARNING, "No site email address configured. Please set one.");
     }
     common_switch_locale($user->language);
     // TRANS: E-mail subject. %s is the StatusNet sitename.
     $subject = _m('Contact the %s administrator to retrieve your account');
     // TRANS: E-mail body. %1$s is a username,
     // TRANS: %2$s is the StatusNet sitename, %3$s is the site contact e-mail address.
     $msg = _m("Hi %1\$s,\n\n" . "We have noticed you have deauthorized the Facebook connection for your\n" . "%2\$s account.  You have not set a password for your %2\$s account yet, so\n" . "you will not be able to login. If you wish to continue using your %2\$s\n" . "account, please contact the site administrator (%3\$s) to set a password.\n\n" . "Sincerely,\n\n" . "%2\$s\n");
     $body = sprintf($msg, $user->nickname, $siteName, $siteEmail);
     common_switch_locale();
     if (mail_to_user($user, $subject, $body)) {
         common_log(LOG_INFO, sprintf('Sent account lockout warning to %s (%d)', $user->nickname, $user->id), __FILE__);
     } else {
         common_log(LOG_WARNING, sprintf('Unable to send account lockout warning to %s (%d)', $user->nickname, $user->id), __FILE__);
     }
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:22,代码来源:facebookclient.php

示例11: recoverPassword

 function recoverPassword()
 {
     $nore = $this->trimmed('nicknameoremail');
     if (!$nore) {
         $this->showForm(_('Enter a nickname or email address.'));
         return;
     }
     $user = User::staticGet('email', common_canonical_email($nore));
     if (!$user) {
         $user = User::staticGet('nickname', common_canonical_nickname($nore));
     }
     # See if it's an unconfirmed email address
     if (!$user) {
         $confirm_email = Confirm_address::staticGet('address', common_canonical_email($nore));
         if ($confirm_email && $confirm_email->address_type == 'email') {
             $user = User::staticGet($confirm_email->user_id);
         }
     }
     if (!$user) {
         $this->showForm(_('No user with that email address or username.'));
         return;
     }
     # Try to get an unconfirmed email address if they used a user name
     if (!$user->email && !$confirm_email) {
         $confirm_email = Confirm_address::staticGet('user_id', $user->id);
         if ($confirm_email && $confirm_email->address_type != 'email') {
             # Skip non-email confirmations
             $confirm_email = null;
         }
     }
     if (!$user->email && !$confirm_email) {
         $this->clientError(_('No registered email address for that user.'));
         return;
     }
     # Success! We have a valid user and a confirmed or unconfirmed email address
     $confirm = new Confirm_address();
     $confirm->code = common_confirmation_code(128);
     $confirm->address_type = 'recover';
     $confirm->user_id = $user->id;
     $confirm->address = isset($user->email) ? $user->email : $confirm_email->address;
     if (!$confirm->insert()) {
         common_log_db_error($confirm, 'INSERT', __FILE__);
         $this->serverError(_('Error saving address confirmation.'));
         return;
     }
     $body = "Hey, {$user->nickname}.";
     $body .= "\n\n";
     $body .= 'Someone just asked for a new password ' . 'for this account on ' . common_config('site', 'name') . '.';
     $body .= "\n\n";
     $body .= 'If it was you, and you want to confirm, use the URL below:';
     $body .= "\n\n";
     $body .= "\t" . common_local_url('recoverpassword', array('code' => $confirm->code));
     $body .= "\n\n";
     $body .= 'If not, just ignore this message.';
     $body .= "\n\n";
     $body .= 'Thanks for your time, ';
     $body .= "\n";
     $body .= common_config('site', 'name');
     $body .= "\n";
     mail_to_user($user, _('Password recovery requested'), $body, $confirm->address);
     $this->mode = 'sent';
     $this->msg = _('Instructions for recovering your password ' . 'have been sent to the email address registered to your ' . 'account.');
     $this->success = true;
     $this->showPage();
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:65,代码来源:recoverpassword.php

示例12: handle


//.........这里部分代码省略.........
     $user = User::staticGet('id', $user_id);
     if (empty($user)) {
         common_log(LOG_INFO, sprintf('Not sending email summary for user %s; no such user.', $user_id));
         return true;
     }
     if (empty($user->email)) {
         common_log(LOG_INFO, sprintf('Not sending email summary for user %s; no email address.', $user_id));
         return true;
     }
     $profile = $user->getProfile();
     if (empty($profile)) {
         common_log(LOG_WARNING, sprintf('Not sending email summary for user %s; no profile.', $user_id));
         return true;
     }
     $stream = new InboxNoticeStream($user, $user->getProfile());
     $notice = $stream->getNotices(0, self::MAX_NOTICES, $since_id);
     if (empty($notice) || $notice->N == 0) {
         common_log(LOG_WARNING, sprintf('Not sending email summary for user %s; no notices.', $user_id));
         return true;
     }
     // XXX: This is risky fingerpoken in der objektvars, but I didn't feel like
     // figuring out a better way. -ESP
     $new_top = null;
     if ($notice instanceof ArrayWrapper) {
         $new_top = $notice->_items[0]->id;
     }
     // TRANS: Subject for e-mail.
     $subject = sprintf(_m('Your latest updates from %s'), common_config('site', 'name'));
     $out = new XMLStringer(true);
     $out->elementStart('html');
     $out->elementStart('head');
     $out->element('title', null, $subject);
     $out->elementEnd('head');
     $out->elementStart('body');
     $out->elementStart('div', array('width' => '100%', 'style' => 'background-color: #ffffff; border: 4px solid #4c609a; padding: 10px;'));
     $out->elementStart('div', array('style' => 'color: #ffffff; background-color: #4c609a; font-weight: bold; margin-bottom: 10px; padding: 4px;'));
     // TRANS: Text in e-mail summary.
     // TRANS: %1$s is the StatusNet sitename, %2$s is the recipient's profile name.
     $out->raw(sprintf(_m('Recent updates from %1$s for %2$s:'), common_config('site', 'name'), $profile->getBestName()));
     $out->elementEnd('div');
     $out->elementStart('table', array('width' => '550px', 'style' => 'border: none; border-collapse: collapse;', 'cellpadding' => '6'));
     while ($notice->fetch()) {
         $profile = Profile::staticGet('id', $notice->profile_id);
         if (empty($profile)) {
             continue;
         }
         $avatar = $profile->getAvatar(AVATAR_STREAM_SIZE);
         $out->elementStart('tr');
         $out->elementStart('td', array('width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, 'align' => 'left', 'valign' => 'top', 'style' => 'border-bottom: 1px dotted #C5CEE3; padding: 10px 6px 10px 6px;'));
         $out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE), 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, 'alt' => $profile->getBestName()));
         $out->elementEnd('td');
         $out->elementStart('td', array('align' => 'left', 'valign' => 'top', 'style' => 'border-bottom: 1px dotted #C5CEE3; padding: 10px 6px 10px 6px;'));
         $out->element('a', array('href' => $profile->profileurl), $profile->nickname);
         $out->text(' ');
         $out->raw($notice->rendered);
         $out->elementStart('div', array('style' => 'font-size: 0.8em; padding-top: 4px;'));
         $noticeurl = $notice->bestUrl();
         // above should always return an URL
         assert(!empty($noticeurl));
         $out->elementStart('a', array('rel' => 'bookmark', 'href' => $noticeurl));
         $dt = common_date_iso8601($notice->created);
         $out->element('abbr', array('style' => 'border-bottom: none;', 'title' => $dt), common_date_string($notice->created));
         $out->elementEnd('a');
         if ($notice->hasConversation()) {
             $conv = Conversation::staticGet('id', $notice->conversation);
             $convurl = $conv->uri;
             if (!empty($convurl)) {
                 $out->text(' ');
                 $out->element('a', array('href' => $convurl . '#notice-' . $notice->id), _m('in context'));
             }
         }
         $out->elementEnd('div');
         $out->elementEnd('td');
         $out->elementEnd('tr');
     }
     $out->elementEnd('table');
     // TRANS: Link text for link to e-mail settings.
     // TRANS: %1$s is a link to the e-mail settings, %2$s is the StatusNet sitename.
     $out->raw("<p>" . sprintf(_m('<a href="%1$s">change your email settings for %2$s</a>'), common_local_url('emailsettings'), common_config('site', 'name')) . "</p>");
     $out->elementEnd('div');
     $out->elementEnd('body');
     $out->elementEnd('html');
     $body = $out->getString();
     // FIXME: do something for people who don't like HTML email
     mail_to_user($user, $subject, $body, array('Content-Type' => 'text/html; charset=utf-8', 'Mime-Version' => '1.0'));
     if (empty($ess)) {
         $ess = new Email_summary_status();
         $ess->user_id = $user_id;
         $ess->created = common_sql_now();
         $ess->last_summary_id = $new_top;
         $ess->modified = common_sql_now();
         $ess->insert();
     } else {
         $orig = clone $ess;
         $ess->last_summary_id = $new_top;
         $ess->modified = common_sql_now();
         $ess->update($orig);
     }
     return true;
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:101,代码来源:useremailsummaryhandler.php

示例13: notify_mail

 function notify_mail($other, $user, $notice)
 {
     $profile = $user->getProfile();
     $bestname = $profile->getBestName();
     $subject = sprintf(_('%s added your notice as a favorite'), $bestname);
     $body = sprintf(_("%1\$s just added your notice from %2\$s as one of their favorites.\n\n" . "In case you forgot, you can see the text of your notice here:\n\n" . "%3\$s\n\n" . "You can see the list of %1\$s's favorites here:\n\n" . "%4\$s\n\n" . "Faithfully yours,\n" . "%5\$s\n"), $bestname, common_exact_date($notice->created), common_local_url('shownotice', array('notice' => $notice->id)), common_local_url('showfavorites', array('nickname' => $user->nickname)), common_config('site', 'name'));
     mail_to_user($other, $subject, $body);
 }
开发者ID:Br3nda,项目名称:laconica,代码行数:8,代码来源:twitapifavorites.php

示例14: notifyByMail

 function notifyByMail()
 {
     $to = User::staticGet('id', $this->to_profile);
     if (empty($to) || is_null($to->email) || !$to->emailnotifymsg) {
         return true;
     }
     $gm = Group_message::staticGet('id', $this->group_message_id);
     $from_profile = Profile::staticGet('id', $gm->from_profile);
     $group = $gm->getGroup();
     common_switch_locale($to->language);
     // TRANS: Subject for direct-message notification email.
     // TRANS: %s is the sending user's nickname.
     $subject = sprintf(_('New private message from %s to group %s'), $from_profile->nickname, $group->nickname);
     // TRANS: Body for direct-message notification email.
     // TRANS: %1$s is the sending user's long name, %2$s is the sending user's nickname,
     // TRANS: %3$s is the message content, %4$s a URL to the message,
     // TRANS: %5$s is the StatusNet sitename.
     $body = sprintf(_("%1\$s (%2\$s) sent a private message to group %3\$s:\n\n" . "------------------------------------------------------\n" . "%4\$s\n" . "------------------------------------------------------\n\n" . "You can reply to their message here:\n\n" . "%5\$s\n\n" . "Don't reply to this email; it won't get to them.\n\n" . "With kind regards,\n" . "%6\$s\n"), $from_profile->getBestName(), $from_profile->nickname, $group->nickname, $gm->content, common_local_url('newmessage', array('to' => $from_profile->id)), common_config('site', 'name'));
     $headers = _mail_prepare_headers('message', $to->nickname, $from_profile->nickname);
     common_switch_locale();
     return mail_to_user($to, $subject, $body, $headers);
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:22,代码来源:Group_message_profile.php

示例15: recoverPassword

 static function recoverPassword($nore)
 {
     // $confirm_email will be used as a fallback if our user doesn't have a confirmed email
     $confirm_email = null;
     if (common_is_email($nore)) {
         $user = User::getKV('email', common_canonical_email($nore));
         // See if it's an unconfirmed email address
         if (!$user instanceof User) {
             // Warning: it may actually be legit to have multiple folks
             // who have claimed, but not yet confirmed, the same address.
             // We'll only send to the first one that comes up.
             $confirm_email = new Confirm_address();
             $confirm_email->address = common_canonical_email($nore);
             $confirm_email->address_type = 'email';
             if ($confirm_email->find(true)) {
                 $user = User::getKV('id', $confirm_email->user_id);
             }
         }
         // No luck finding anyone by that email address.
         if (!$user instanceof User) {
             if (common_config('site', 'fakeaddressrecovery')) {
                 // Return without actually doing anything! We fake address recovery
                 // to avoid revealing which email addresses are registered with the site.
                 return;
             }
             // TRANS: Information on password recovery form if no known e-mail address was specified.
             throw new ClientException(_('No user with that email address exists here.'));
         }
     } else {
         // This might throw a NicknameException on bad nicknames
         $user = User::getKV('nickname', common_canonical_nickname($nore));
         if (!$user instanceof User) {
             // TRANS: Information on password recovery form if no known username was specified.
             throw new ClientException(_('No user with that nickname exists here.'));
         }
     }
     // Try to get an unconfirmed email address if they used a user name
     if (empty($user->email) && $confirm_email === null) {
         $confirm_email = new Confirm_address();
         $confirm_email->user_id = $user->id;
         $confirm_email->address_type = 'email';
         $confirm_email->find();
         if (!$confirm_email->fetch()) {
             // Nothing found, so let's reset it to null
             $confirm_email = null;
         }
     }
     if (empty($user->email) && !$confirm_email instanceof Confirm_address) {
         // TRANS: Client error displayed on password recovery form if a user does not have a registered e-mail address.
         throw new ClientException(_('No registered email address for that user.'));
     }
     // Success! We have a valid user and a confirmed or unconfirmed email address
     $confirm = new Confirm_address();
     $confirm->code = common_confirmation_code(128);
     $confirm->address_type = 'recover';
     $confirm->user_id = $user->id;
     $confirm->address = $user->email ?: $confirm_email->address;
     if (!$confirm->insert()) {
         common_log_db_error($confirm, 'INSERT', __FILE__);
         // TRANS: Server error displayed if e-mail address confirmation fails in the database on the password recovery form.
         throw new ServerException(_('Error saving address confirmation.'));
     }
     // @todo FIXME: needs i18n.
     $body = "Hey, {$user->nickname}.";
     $body .= "\n\n";
     $body .= 'Someone just asked for a new password ' . 'for this account on ' . common_config('site', 'name') . '.';
     $body .= "\n\n";
     $body .= 'If it was you, and you want to confirm, use the URL below:';
     $body .= "\n\n";
     $body .= "\t" . common_local_url('recoverpassword', array('code' => $confirm->code));
     $body .= "\n\n";
     $body .= 'If not, just ignore this message.';
     $body .= "\n\n";
     $body .= 'Thanks for your time, ';
     $body .= "\n";
     $body .= common_config('site', 'name');
     $body .= "\n";
     $headers = _mail_prepare_headers('recoverpassword', $user->nickname, $user->nickname);
     // TRANS: Subject for password recovery e-mail.
     mail_to_user($user, _('Password recovery requested'), $body, $headers, $confirm->address);
 }
开发者ID:phpsource,项目名称:gnu-social,代码行数:81,代码来源:User.php


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