本文整理汇总了PHP中Mail::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Mail::instance方法的具体用法?PHP Mail::instance怎么用?PHP Mail::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mail
的用法示例。
在下文中一共展示了Mail::instance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
public static function getInstance()
{
if (!isset(self::$instance)) {
self::createTransport();
self::createMailer();
self::$instance = new static();
}
return self::$instance;
}
示例2: _setcookie
$Config = Config::instance();
$L = Language::instance();
$Page = Page::instance();
$User = User::instance();
if (_getcookie('restore_password_confirm')) {
_setcookie('restore_password_confirm', '');
$Page->title($L->restore_password_success_title);
$Page->success($L->restore_password_success);
return;
} elseif (!$User->guest()) {
$Page->title($L->you_are_already_registered_title);
$Page->warning($L->you_are_already_registered);
return;
} elseif (!isset($Config->route[2])) {
$Page->title($L->invalid_confirmation_code);
$Page->warning($L->invalid_confirmation_code);
return;
}
$result = $User->restore_password_confirmation($Config->route[2]);
if ($result === false) {
$Page->title($L->invalid_confirmation_code);
$Page->warning($L->invalid_confirmation_code);
return;
}
if (Mail::instance()->send_to($User->get('email', $result['id']), $L->restore_password_success_mail(get_core_ml_text('name')), $L->restore_password_success_mail_body($User->username($result['id']), get_core_ml_text('name'), $Config->core_url() . '/profile/settings', $User->get('login', $result['id']), $result['password']))) {
_setcookie('restore_password_confirm', 1);
header("Location: {$Config->base_url()}/System/profile/restore_password_confirmation");
} else {
$Page->title($L->sending_reg_mail_error_title);
$Page->warning($L->sending_reg_mail_error);
}
示例3: _setcookie
$Page = Page::instance();
$User = User::instance();
if (_getcookie('reg_confirm')) {
_setcookie('reg_confirm', '');
$Page->title($L->reg_success_title);
$Page->success($L->reg_success);
return;
} elseif (!$User->guest()) {
$Page->title($L->you_are_already_registered_title);
$Page->warning($L->you_are_already_registered);
return;
} elseif (!isset($Config->route[2])) {
$Page->title($L->invalid_confirmation_code);
$Page->warning($L->invalid_confirmation_code);
return;
}
$result = $User->registration_confirmation($Config->route[2]);
if ($result === false) {
$Page->title($L->invalid_confirmation_code);
$Page->warning($L->invalid_confirmation_code);
return;
}
$body = $L->reg_success_mail_body(strstr($result['email'], '@', true), get_core_ml_text('name'), $Config->core_url() . '/profile/settings', $User->get('login', $result['id']), $result['password']);
if (Mail::instance()->send_to($result['email'], $L->reg_success_mail(get_core_ml_text('name')), $body)) {
_setcookie('reg_confirm', 1);
header("Location: {$Config->base_url()}/System/profile/registration_confirmation");
} else {
$User->registration_cancel();
$Page->title($L->sending_reg_mail_error_title);
$Page->warning($L->sending_reg_mail_error);
}
示例4: mb_strtolower
return;
}
$_POST['email'] = mb_strtolower($_POST['email']);
$result = $User->registration($_POST['email']);
if ($result === false) {
error_code(400);
$Page->error($L->please_type_correct_email);
sleep(1);
return;
} elseif ($result == 'error') {
error_code(500);
$Page->error($L->reg_server_error);
return;
} elseif ($result == 'exists') {
error_code(400);
$Page->error($L->reg_error_exists);
return;
}
$confirm = $result['reg_key'] !== true;
if ($confirm) {
$body = $L->reg_need_confirmation_mail_body(strstr($_POST['email'], '@', true), get_core_ml_text('name'), $Config->core_url() . "/profile/registration_confirmation/{$result['reg_key']}", $L->time($Config->core['registration_confirmation_time'], 'd'));
} else {
$body = $L->reg_success_mail_body(strstr($_POST['email'], '@', true), get_core_ml_text('name'), $Config->core_url() . '/profile/settings', $User->get('login', $result['id']), $result['password']);
}
if (Mail::instance()->send_to($_POST['email'], $L->{$confirm ? 'reg_need_confirmation_mail' : 'reg_success_mail'}(get_core_ml_text('name')), $body)) {
$Page->json($confirm ? 'reg_confirmation' : 'reg_success');
} else {
$User->registration_cancel();
error_code(500);
$Page->error($L->sending_reg_mail_error);
}
示例5: sleep
* @copyright Copyright (c) 2011-2014, Nazar Mokrynskyi
* @license MIT License, see license.txt
*/
namespace cs;
$Config = Config::instance();
$L = Language::instance();
$Page = Page::instance();
$User = User::instance();
/**
* If AJAX request from local referer, user is guest - send request for password restore, otherwise - show error
*/
if (!$Config->server['referer']['local'] || !$Config->server['ajax'] || !isset($_POST['email']) || !$User->guest()) {
sleep(1);
error_code(403);
return;
} elseif (!$_POST['email']) {
error_code(400);
$Page->error($L->please_type_your_email);
return;
} elseif (!($id = $User->get_id(mb_strtolower($_POST['email'])))) {
error_code(400);
$Page->error($L->user_with_such_login_email_not_found);
return;
}
if (($key = $User->restore_password($id)) && Mail::instance()->send_to($User->get('email', $id), $L->restore_password_confirmation_mail(get_core_ml_text('name')), $L->restore_password_confirmation_mail_body($User->username($id), get_core_ml_text('name'), $Config->core_url() . "/profile/restore_password_confirmation/{$key}", $L->time($Config->core['registration_confirmation_time'], 'd')))) {
$Page->json('OK');
} else {
error_code(500);
$Page->error($L->restore_password_server_error);
}