本文整理汇总了PHP中Mailer::Mail方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::Mail方法的具体用法?PHP Mailer::Mail怎么用?PHP Mailer::Mail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mailer
的用法示例。
在下文中一共展示了Mailer::Mail方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _xForgotPasswordConfirm
function _xForgotPasswordConfirm()
{
global $t, $C;
require_once 'validator.php';
$v =& Validator::Get();
$v->Register($_REQUEST['domain'], VT_NOT_EMPTY, "The 'Domain' field is required");
$v->Register($_REQUEST['email'], VT_VALID_EMAIL, "The 'E-mail' field must be a valid e-mail address");
$trade = null;
if (!string_is_empty($_REQUEST['domain'])) {
require_once 'dirdb.php';
$db = new TradeDB();
$trade = $db->Retrieve($_REQUEST['domain']);
$v->Register(empty($trade), VT_IS_FALSE, "The Domain entered does not exist in our database");
if (!empty($trade)) {
$v->Register($_REQUEST['email'], VT_EQUALS, "The E-mail entered does not match the e-mail address for this domain", $trade['email']);
}
}
if (!$v->Validate()) {
$t->Assign('g_errors', $v->GetErrors());
return _xForgotPasswordShow();
}
require_once 'textdb.php';
$trade['confirm_id'] = md5(uniqid(rand(), true));
$db = new PasswordConfirmsDB();
$db->Add(array('confirm_id' => $trade['confirm_id'], 'domain' => $_REQUEST['domain'], 'timestamp' => time()));
$t->AssignByRef('g_trade', $trade);
require_once 'mailer.php';
$m = new Mailer();
$m->Mail('email-forgot-confirm.tpl', $t, $trade['email'], $trade['email']);
$t->Display('trade-stats-forgot-confirm.tpl');
}
示例2: tbxDisplayResetConfirm
function tbxDisplayResetConfirm()
{
global $t;
$DB = GetDB();
$v = Validator::Create();
// Remove expired codes
$DB->Update('DELETE FROM `tbx_user_reset_code` WHERE `timestamp` < ?', array(time() - 3600));
$confirmation = $DB->Row('SELECT * FROM `tbx_user` JOIN `tbx_user_reset_code` USING (`username`) WHERE `reset_code`=?', array($_REQUEST['code']));
$v->Register(empty($confirmation), Validator_Type::IS_FALSE, _T('Validation:Invalid confirmation code'));
if (!$v->Validate()) {
$t->Assign('g_errors', $v->GetErrors());
} else {
$DB->Update('DELETE FROM `tbx_user_reset_code` WHERE `username`=?', array($confirmation['username']));
$user = $DB->Row('SELECT * FROM `tbx_user` JOIN `tbx_user_custom` USING (`username`) JOIN `tbx_user_stat` USING (`username`) WHERE `tbx_user`.`username`=?', array($confirmation['username']));
$password = RandomPassword();
DatabaseUpdate('tbx_user', array('username' => $user['username'], 'password' => sha1($password)));
$t->AssignByRef('g_user', $user);
$t->Assign('g_password', $password);
$m = new Mailer();
$m->Mail('email-user-reset.tpl', $t, $user['email'], $user['name']);
}
$t->Display('user-reset-confirmed.tpl');
}
示例3: tbxAdministratorEmail
function tbxAdministratorEmail($administrator, $xtable, $template = null)
{
$DB = GetDB();
if (empty($template)) {
$template = array();
$template['subject'] = Request::Get('subject');
$template['message'] = Request::Get('message');
}
$t = new Template();
$t->Assign('g_config', Config::GetAll());
$t->AssignByRef('g_administrator', $administrator);
$mailer = new Mailer();
$mailer->Mail($template, $t, $administrator['email'], $administrator['name']);
}
示例4: _xConfirmShow
function _xConfirmShow()
{
global $t, $C;
require_once 'textdb.php';
$db = new RegisterConfirmsDB();
$db->DeleteExpired();
$confirm = $db->Retrieve($_REQUEST['id']);
require_once 'validator.php';
$v =& Validator::Get();
$v->Register(empty($confirm), VT_IS_FALSE, 'Invalid or expired confirmation code');
if (!$v->Validate()) {
$t->Assign('g_invalid_confirm', true);
} else {
$db->Delete($_REQUEST['id']);
$defaults = unserialize(file_get_contents(FILE_NEW_TRADE_DEFAULTS));
require_once 'dirdb.php';
$password = get_random_password();
$db = new TradeDB();
$trade = $db->Update($confirm['domain'], array('status' => $defaults['status'], 'timestamp_autostop' => time(), 'password' => sha1($password)));
$trade['password'] = $password;
$t->AssignByRef('g_trade', $trade);
require_once 'mailer.php';
if ($C['flag_register_email_user'] && !string_is_empty($trade['email'])) {
$m = new Mailer();
$m->Mail('email-register-complete.tpl', $t, $trade['email'], $trade['email']);
}
if ($C['flag_register_email_admin']) {
$m = new Mailer();
$m->Mail('email-register-admin.tpl', $t, $C['email_address'], $C['email_name']);
}
}
$t->Display('register-confirm.tpl');
}
示例5: trade_add
function trade_add(&$data, $registered = false)
{
global $C;
require_once 'dirdb.php';
require_once 'mailer.php';
require_once 'template.php';
$t = new Template();
$t->AssignByRef('g_config', $C);
$t->AssignByRef('g_trade', $data);
$db = new TradeDB();
$db->Add(trade_prepare_data($data));
// Create stats file
$packed_record = trade_packed_record();
$fp = fopen(DIR_TRADE_STATS . "/{$data['domain']}", 'w');
for ($i = 0; $i < HOURS_PER_DAY + MINUTES_PER_DAY; $i++) {
fwrite($fp, $packed_record, RECORD_SIZE_STATS);
}
fclose($fp);
@chmod(DIR_TRADE_STATS . "/{$data['domain']}", 0666);
// Create log files
file_create(DIR_TRADE_STATS . "/{$data['domain']}-clicks");
file_create(DIR_TRADE_STATS . "/{$data['domain']}-history");
file_create(DIR_TRADE_STATS . "/{$data['domain']}-in");
file_create(DIR_TRADE_STATS . "/{$data['domain']}-out");
if ($data['flag_confirm']) {
require_once 'textdb.php';
$data['confirm_id'] = md5(uniqid(rand(), true));
$confdb = new RegisterConfirmsDB();
$confdb->Add(array('confirm_id' => $data['confirm_id'], 'domain' => $data['domain'], 'timestamp' => time()));
$m = new Mailer();
$m->Mail('email-register-confirm.tpl', $t, $data['email'], $data['email']);
} else {
if ($C['flag_register_email_user'] && !string_is_empty($data['email']) && $registered) {
$m = new Mailer();
$m->Mail('email-register-complete.tpl', $t, $data['email'], $data['email']);
}
if ($C['flag_register_email_admin']) {
$m = new Mailer();
$m->Mail('email-register-admin.tpl', $t, $C['email_address'], $C['email_name']);
}
}
}
示例6: _xTradesEmail
function _xTradesEmail()
{
global $C, $compiler;
require_once 'mailer.php';
$v =& Validator::Get();
$v->Register($_REQUEST[MAILER_KEY_SUBJECT], VT_NOT_EMPTY, "The 'Subject' field is required");
$v->Register($_REQUEST[MAILER_KEY_BODY], VT_NOT_EMPTY, "The 'Body' field is required");
if (!$v->Validate()) {
return JSON::Warning(array(JSON_KEY_MESSAGE => 'E-mail could not be sent; please fix the following items', JSON_KEY_WARNINGS => $v->GetErrors()));
}
require_once 'dirdb.php';
require_once 'template.php';
require_once 'compiler.php';
$_REQUEST[MAILER_KEY_SUBJECT] = $compiler->Compile($_REQUEST[MAILER_KEY_SUBJECT]);
$_REQUEST[MAILER_KEY_BODY] = $compiler->Compile($_REQUEST[MAILER_KEY_BODY]);
$mailer = new Mailer();
$db = new TradeDB();
$t = new Template();
$t->AssignByRef('g_config', $C);
foreach (explode(',', $_REQUEST['domain']) as $domain) {
$trade = $db->Retrieve($domain);
if (!empty($trade) && !string_is_empty($trade['email'])) {
$t->AssignByRef('g_trade', $trade);
$mailer->Mail($_REQUEST, $t, $trade['email'], string_is_empty($trade['nickname']) ? $trade['email'] : $trade['nickname']);
}
}
JSON::Success('E-mail message has been sent to the selected trades');
}