本文整理匯總了PHP中iPHP::sendmail方法的典型用法代碼示例。如果您正苦於以下問題:PHP iPHP::sendmail方法的具體用法?PHP iPHP::sendmail怎麽用?PHP iPHP::sendmail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iPHP
的用法示例。
在下文中一共展示了iPHP::sendmail方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ACTION_findpwd
public function ACTION_findpwd()
{
$seccode = iS::escapeStr($_POST['seccode']);
iPHP::seccode($seccode, true) or iPHP::code(0, 'iCMS:seccode:error', 'seccode', 'json');
$uid = (int) $_POST['uid'];
$auth = iS::escapeStr($_POST['auth']);
if ($auth && $uid) {
//print_r($_POST);
$authcode = rawurldecode($auth);
$authcode = base64_decode($authcode);
$authcode = authcode($authcode);
if (empty($authcode)) {
iPHP::code(0, 'user:findpwd:error', 'uname', 'json');
}
list($uid, $username, $password, $timeline) = explode(USER_AUTHASH, $authcode);
$now = time();
if ($now - $timeline > 86400) {
iPHP::code(0, 'user:findpwd:error', 'time', 'json');
}
$user = user::get($uid, false);
if ($username != $user->username || $password != $user->password) {
iPHP::code(0, 'user:findpwd:error', 'user', 'json');
}
$rstpassword = md5(trim($_POST['rstpassword']));
if ($rstpassword == $user->password) {
iPHP::code(0, 'user:findpwd:same', 'password', 'json');
}
iDB::update("user", array('password' => $rstpassword), array('uid' => $uid));
iPHP::code(1, 'user:findpwd:success', 0, 'json');
} else {
$uname = iS::escapeStr($_POST['uname']);
$uname or iPHP::code(0, 'user:findpwd:username:empty', 'uname', 'json');
$uid = user::check($uname, 'username');
$uid or iPHP::code(0, 'user:findpwd:username:noexist', 'uname', 'json');
$user = user::get($uid, false);
$user or iPHP::code(0, 'user:findpwd:username:noexist', 'uname', 'json');
$authcode = authcode($uid . USER_AUTHASH . $user->username . USER_AUTHASH . $user->password . USER_AUTHASH . time(), 'ENCODE');
$authcode = base64_encode($authcode);
$authcode = rawurlencode($authcode);
$find_url = iPHP::router('/api/user/findpwd', iPHP_ROUTER_REWRITE, '?&');
if (iPHP_ROUTER_REWRITE) {
$find_url = iFS::fp($find_url, '+http');
}
$find_url .= 'auth=' . $authcode;
$config = iCMS::$config['mail'];
$config['title'] = iCMS::$config['site']['name'];
$config['subject'] = '[' . $config['title'] . '] 找回密碼(重要)!';
$config['body'] = '
<p>尊敬的' . $user->nickname . ',您好:</p>
<br />
<p>您在' . $config['title'] . '申請找回密碼,重設密碼地址:</p>
<a href="' . $find_url . '" target="_blank">' . $find_url . '</a>
<p>本鏈接將在24小時後失效!</p>
<p>如果上麵的鏈接無法點擊,您也可以複製鏈接,粘貼到您瀏覽器的地址欄內,然後按“回車”打開重置密碼頁麵。</p>
<p>如果您有其他問題,請聯係我們:' . $config['replyto'] . '。</p>
<p>如果您沒有進行過找回密碼的操作,請不要點擊上述鏈接,並刪除此郵件。</p>
<p>謝謝!</p>
';
$config['address'] = array(array($user->username, $user->nickname));
//var_dump(iCMS::$config);
$result = iPHP::sendmail($config);
if ($result === true) {
iPHP::code(1, 'user:findpwd:send:success', 'mail', 'json');
} else {
iPHP::code(0, 'user:findpwd:send:failure', 'mail', 'json');
}
}
}