本文整理汇总了PHP中my_mail函数的典型用法代码示例。如果您正苦于以下问题:PHP my_mail函数的具体用法?PHP my_mail怎么用?PHP my_mail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了my_mail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run_task
/**
* Execute a scheduled task.
*
* @param int $tid The task ID. If none specified, the next task due to be ran is executed
* @return boolean True if successful, false on failure
*/
function run_task($tid = 0)
{
global $db, $mybb, $cache, $plugins, $task, $lang;
// Run a specific task
if ($tid > 0) {
$query = $db->simple_select("tasks", "*", "tid='{$tid}'");
$task = $db->fetch_array($query);
} else {
$query = $db->simple_select("tasks", "*", "enabled=1 AND nextrun<='" . TIME_NOW . "'", array("order_by" => "nextrun", "order_dir" => "asc", "limit" => 1));
$task = $db->fetch_array($query);
}
// No task? Return
if (!$task['tid']) {
$cache->update_tasks();
return false;
}
// Is this task still running and locked less than 5 minutes ago? Well don't run it now - clearly it isn't broken!
if ($task['locked'] != 0 && $task['locked'] > TIME_NOW - 300) {
$cache->update_tasks();
return false;
} else {
$db->update_query("tasks", array("locked" => TIME_NOW), "tid='{$task['tid']}'");
}
// The task file does not exist
if (!file_exists(MYBB_ROOT . "inc/tasks/{$task['file']}.php")) {
if ($task['logging'] == 1) {
add_task_log($task, $lang->missing_task);
}
// If task file does not exist, disable task and inform the administrator
$updated_task = array("enabled" => 0, "locked" => 0);
$db->update_query("tasks", $updated_task, "tid='{$task['tid']}'");
$subject = $lang->sprintf($lang->email_broken_task_subject, $mybb->settings['bbname']);
$message = $lang->sprintf($lang->email_broken_task, $mybb->settings['bbname'], $mybb->settings['bburl'], $task['title']);
my_mail($mybb->settings['adminemail'], $subject, $message, $mybb->settings['adminemail']);
$cache->update_tasks();
return false;
} else {
// Update the nextrun time now, so if the task causes a fatal error, it doesn't get stuck first in the queue
$nextrun = fetch_next_run($task);
$db->update_query("tasks", array("nextrun" => $nextrun), "tid='{$task['tid']}'");
include_once MYBB_ROOT . "inc/tasks/{$task['file']}.php";
$function = "task_{$task['file']}";
if (function_exists($function)) {
$function($task);
}
}
$updated_task = array("lastrun" => TIME_NOW, "locked" => 0);
$db->update_query("tasks", $updated_task, "tid='{$task['tid']}'");
$cache->update_tasks();
return true;
}
示例2: send_contact
function send_contact()
{
global $realname, $company, $address, $address2, $address3, $postcode, $country;
global $telephone, $email, $comments;
// $mail_to="comment@henrytaunt-footsteps.co.uk"
$mail_to = "comment@henrytaunt-footsteps.co.uk";
$mail_subject = "Henry Taunt Footsteps support";
$mail_body = "\tCONTACT DETAILS\n\nFeedback from Henry Taunt Footsteps website:\n\n";
$mail_body .= $realname . "\n" . $company . "\n";
$mail_body .= $address . "\n" . $address2 . "\n" . $address3 . "\n" . $postcode . "\n" . $country . "\n\n";
$mail_body .= "Phone - " . $telephone . "\n" . "E-mail - " . $email . "\n\n";
$mail_body .= "Comments:" . "\n" . $comments . "\n\n";
$mail_parts["mail_to"] = $mail_to;
$mail_parts["mail_subject"] = $mail_subject;
$mail_parts["mail_body"] = $mail_body;
if (my_mail($mail_parts)) {
user_message("You have just successfully sent to INVC an e-mail titled '{$mail_subject}'.", 2);
} else {
error_message("An unknown error occurred while attempting to send an e-mail titled '{$mail_subject}'.");
}
}
示例3: random_str
$verified = false;
$db->delete_query("awaitingactivation", "uid='{$user['uid']}' AND type='p'");
$user['activationcode'] = random_str();
$now = TIME_NOW;
$uid = $user['uid'];
$awaitingarray = array("uid" => $user['uid'], "dateline" => TIME_NOW, "code" => $user['activationcode'], "type" => "p");
$db->insert_query("awaitingactivation", $awaitingarray);
$username = $user['username'];
$email = $user['email'];
$activationcode = $user['activationcode'];
$emailsubject = $lang->sprintf($lang->emailsubject_lostpw, $mybb->settings['bbname']);
switch ($mybb->settings['username_method']) {
case 0:
$emailmessage = $lang->sprintf($lang->email_lostpw, $username, $mybb->settings['bbname'], $mybb->settings['bburl'], $uid, $activationcode);
break;
case 1:
$emailmessage = $lang->sprintf($lang->email_lostpw1, $username, $mybb->settings['bbname'], $mybb->settings['bburl'], $uid, $activationcode);
break;
case 2:
$emailmessage = $lang->sprintf($lang->email_lostpw2, $username, $mybb->settings['bbname'], $mybb->settings['bburl'], $uid, $activationcode);
break;
default:
$emailmessage = $lang->sprintf($lang->email_lostpw, $username, $mybb->settings['bbname'], $mybb->settings['bburl'], $uid, $activationcode);
break;
}
my_mail($email, $emailsubject, $emailmessage);
$plugins->run_hooks("member_do_lostpw_end");
$result_text = $lang->redirect_lostpwsent;
}
}
}
示例4: send_forgot_password
public function send_forgot_password($email)
{
$this->db->select()->from('users')->where('email', $email);
$query = $this->db->get();
if ($query->num_rows() == 0) {
$data['status'] = "Error";
$data['message'] = "This email is not registered with us";
} else {
$result = $query->result_array();
$result = $result[0];
$token = md5(rand() . microtime() . rand()) . md5(time());
$value['email'] = $email;
$value['token'] = $token;
$value['used'] = '0';
$this->db->insert('lost_password', $value);
$data['status'] = "Success";
$data['message'] = "Reset link sent, please check email";
$this->load->helper('mail_helper');
$baseurl = base_url();
$user_name = $result['name'];
$user_id = $result['id'];
$body = <<<MARKUP
\t\t\tWelcome {$user_name}, please click on this <a href='{$baseurl}login/reset/{$user_id}/{$token}'>link</a> to set your account's password.
MARKUP;
my_mail($email, "Set new password", $body);
}
return $data;
}
示例5: my_die
function my_die($error = '')
{
if (is_string($error)) {
if (empty($error)) {
$error = 'db_error';
}
$error .= ': ' . my_trace(debug_backtrace());
$error .= "\r\n" . mysql_error();
} elseif (is_object($error)) {
$error = $error->getMessage() . ': ' . my_exeption_trace($error);
}
$subject = $_SERVER['HTTP_HOST'] . ' ' . 'error';
$message = $error . "\r\n\r\n" . my_info();
my_mail($message, $subject);
if (defined('DEBUG') || defined('LOCALHOST')) {
// echo("<div style=\"padding: 20px; margin: 20px; border: 1px solid red;\"><pre>$error</pre></div>");
include_once FLGR_COMMON . '/exit.php';
} else {
$die = "Произошла ошибка.<br />";
$die .= "Администратору сайта выслан e-mail с ее описанием - <br />";
$die .= "он постарается все исправить в самое ближайшее время.";
echo $die;
include_once FLGR_COMMON . '/exit.php';
}
}
示例6: emailNotification2ModsAndAdmins
/**
* sends an e-mail notification to all admins and mods who have activated
* e-mail notification
*
* @param int $id : the id of the posting
* @param bool $delayed : true adds a delayed message (when postibg was activated manually)
*/
function emailNotification2ModsAndAdmins($id, $delayed = false)
{
global $settings, $db_settings, $lang, $connid;
$id = intval($id);
// data of posting:
$result = @mysql_query("SELECT pid, name, user_name, " . $db_settings['forum_table'] . ".user_id, subject, text \r\n FROM " . $db_settings['forum_table'] . " \r\n LEFT JOIN " . $db_settings['userdata_table'] . " ON " . $db_settings['userdata_table'] . ".user_id=" . $db_settings['forum_table'] . ".user_id\r\n WHERE id = " . intval($id) . " LIMIT 1", $connid);
$data = mysql_fetch_array($result);
mysql_free_result($result);
// overwrite $data['name'] with $data['user_name'] if registered user:
if ($data['user_id'] > 0) {
if (!$data['user_name']) {
$data['name'] = $lang['unknown_user'];
} else {
$data['name'] = $data['user_name'];
}
}
$name = stripslashes($data['name']);
$subject = stripslashes($data['subject']);
$text = email_format(stripslashes($data['text']));
if ($data['pid'] > 0) {
$emailbody = str_replace("[name]", $name, $lang['admin_email_text_reply']);
} else {
$emailbody = str_replace("[name]", $name, $lang['admin_email_text']);
}
$emailbody = str_replace("[subject]", $subject, $emailbody);
$emailbody = str_replace("[text]", $text, $emailbody);
$emailbody = str_replace("[posting_address]", $settings['forum_address'] . "index.php?id=" . $id, $emailbody);
$emailbody = str_replace("[forum_address]", $settings['forum_address'], $emailbody);
if ($delayed == true) {
$emailbody = $emailbody . "\n\n" . $lang['email_text_delayed_addition'];
}
$emailbody = stripslashes($emailbody);
$lang['admin_email_subject'] = str_replace("[subject]", stripslashes($subject), $lang['admin_email_subject']);
// who gets an E-mail notification?
$recipient_result = @mysql_query("SELECT user_name, user_email FROM " . $db_settings['userdata_table'] . " WHERE user_type > 0 AND new_posting_notification=1", $connid) or raise_error('database_error', mysql_error());
while ($admin_array = mysql_fetch_array($recipient_result)) {
$ind_emailbody = str_replace("[admin]", $admin_array['user_name'], $emailbody);
$recipient = my_mb_encode_mimeheader($admin_array['user_name'], CHARSET, "Q") . " <" . $admin_array['user_email'] . ">";
my_mail($recipient, $lang['admin_email_subject'], $ind_emailbody);
}
mysql_free_result($recipient_result);
}
示例7: captcha
$captcha = new captcha();
if ($captcha->validate_captcha() == false) {
// CAPTCHA validation failed
foreach ($captcha->get_errors() as $error) {
$errors[] = $error;
}
}
}
if (count($errors) == 0) {
if ($mybb->settings['mail_handler'] == 'smtp') {
$from = $mybb->input['fromemail'];
} else {
$from = "{$mybb->input['fromname']} <{$mybb->input['fromemail']}>";
}
$message = $lang->sprintf($lang->email_emailuser, $to_user['username'], $mybb->input['fromname'], $mybb->settings['bbname'], $mybb->settings['bburl'], $mybb->get_input('message'));
my_mail($to_user['email'], $mybb->get_input('subject'), $message, $from, "", "", false, "text", "", $mybb->input['fromemail']);
if ($mybb->settings['mail_logging'] > 0) {
// Log the message
$log_entry = array("subject" => $db->escape_string($mybb->get_input('subject')), "message" => $db->escape_string($mybb->get_input('message')), "dateline" => TIME_NOW, "fromuid" => $mybb->user['uid'], "fromemail" => $db->escape_string($mybb->input['fromemail']), "touid" => $to_user['uid'], "toemail" => $db->escape_string($to_user['email']), "tid" => 0, "ipaddress" => $db->escape_binary($session->packedip), "type" => 1);
$db->insert_query("maillogs", $log_entry);
}
$plugins->run_hooks("member_do_emailuser_end");
redirect(get_profile_link($to_user['uid']), $lang->redirect_emailsent);
} else {
$mybb->input['action'] = "emailuser";
}
}
if ($mybb->input['action'] == "emailuser") {
$plugins->run_hooks("member_emailuser_start");
// Guests or those without permission can't email other users
if ($mybb->usergroup['cansendemail'] == 0) {
示例8: array
$updated_user['usergroup'] = $user['usergroup'];
// Update
if ($user['coppauser']) {
$updated_user = array("coppauser" => 0);
} else {
$db->delete_query("awaitingactivation", "uid='{$user['uid']}'");
}
// Move out of awaiting activation if they're in it.
if ($user['usergroup'] == 5) {
$updated_user['usergroup'] = 2;
}
$plugins->run_hooks("admin_user_users_coppa_activate_commit");
$db->update_query("users", $updated_user, "uid='{$user['uid']}'");
$cache->update_awaitingactivation();
$message = $lang->sprintf($lang->email_adminactivateaccount, $user['username'], $mybb->settings['bbname'], $mybb->settings['bburl']);
my_mail($user['email'], $lang->sprintf($lang->emailsubject_activateaccount, $mybb->settings['bbname']), $message);
// Log admin action
log_admin_action($user['uid'], $user['username']);
if ($mybb->input['from'] == "home") {
if ($user['coppauser']) {
$message = $lang->success_coppa_activated;
} else {
$message = $lang->success_activated;
}
update_admin_session('flash_message2', array('message' => $message, 'type' => 'success'));
} else {
if ($user['coppauser']) {
flash_message($lang->success_coppa_activated, 'success');
} else {
flash_message($lang->success_activated, 'success');
}
示例9: array
// nat
$sql = $Db->sqlGetSelect(DB_PREFIX . DB_TBL_NAT, array('to')) . $Db->sqlGetWhere(array('from' => $sRequest));
$sql = $Db->queryRow($sql);
if (!empty($sql)) {
// 301
// cStat::bSaveEvent(EVENT_301);
$nat = current($sql);
header('301 Moved Permanently');
header('Location: ' . $nat);
die("<h1>301 Moved Permanently</h1>" . '<a href="' . $nat . '">http://' . HOST . $nat . '</a>');
} else {
// 404
header('HTTP/1.1 404 Not Found');
$subject = $_SERVER['HTTP_HOST'] . ' ' . '404 Not Found';
$message = my_info();
my_mail($message, $subject);
// cStat::bSaveEvent(EVENT_404);
die('404 Not Found');
}
}
// Вывод
header('Content-Type: text/html; charset=' . CHARSET);
$sOut = $_t->get();
if (defined('CACHE_ON')) {
if ($bFlagCache) {
$Cashe->Add($sRequest, $nLastId, $sOut);
}
}
//echo preg_replace('/\s{2,}/', ' ', $_t->get());
echo $sOut;
if (defined('DEBUG')) {
示例10: my_die
my_die();
}
$aNotifyUsers = array();
while ($row = mysql_fetch_assoc($sql)) {
$aNotifyUsers[$row['id']] = $row;
}
$aEmailsUsers = array();
foreach ($aNotifyUsers as $k => $v) {
if ($v['not_notify'] == 0 && !empty($v['email']) && $v['email'] != $_SESSION['user']['email']) {
$aEmailsUsers[] = $v['email'];
}
}
$message = 'Пользователь ' . $_SESSION['user']['name'] . ' ответил на ваш комментарий в обсуждении на странице http://' . HOST . $sRequest;
$subject = 'Ответ на ваш комментарий на сайте ' . HOST;
foreach (array_flip($aEmailsUsers) as $k => $v) {
my_mail($message, $subject, $k);
}
}
}
$sql = 'SELECT * FROM `' . DB_PREFIX . DB_TBL_POSTS . '` WHERE `id` = ' . $aRequest[$nLevel + 2];
$sql = mysql_query($sql);
if (false == $sql) {
my_die();
}
$aPost = mysql_fetch_assoc($sql);
if (empty($aPost)) {
// HEAD_TITLE
$_t->assign('head_title', '');
// ADD_BREADCRUMBS
$BreadCrumbs->addBreadCrumbs($sKey, $sTitle);
// BREADCRUMBS
示例11: send_mail_queue
/**
* Sends a specified amount of messages from the mail queue
*
* @param int The number of messages to send (Defaults to 10)
*/
function send_mail_queue($count = 10)
{
global $db, $cache, $plugins;
$plugins->run_hooks("send_mail_queue_start");
// Check to see if the mail queue has messages needing to be sent
$mailcache = $cache->read("mailqueue");
if ($mailcache['queue_size'] > 0 && ($mailcache['locked'] == 0 || $mailcache['locked'] < TIME_NOW - 300)) {
// Lock the queue so no other messages can be sent whilst these are (for popular boards)
$cache->update_mailqueue(0, TIME_NOW);
// Fetch emails for this page view - and send them
$query = $db->simple_select("mailqueue", "*", "", array("order_by" => "mid", "order_dir" => "asc", "limit_start" => 0, "limit" => $count));
while ($email = $db->fetch_array($query)) {
// Delete the message from the queue
$db->delete_query("mailqueue", "mid='{$email['mid']}'");
if ($db->affected_rows() == 1) {
my_mail($email['mailto'], $email['subject'], $email['message'], $email['mailfrom'], "", $email['headers'], true);
}
}
// Update the mailqueue cache and remove the lock
$cache->update_mailqueue(TIME_NOW, 0);
}
$plugins->run_hooks("send_mail_queue_end");
}
示例12: str_replace
} else {
$new_user_notif_txt = $lang['new_user_notif_txt'];
}
$new_user_notif_txt = str_replace("[name]", $data['user_name'], $new_user_notif_txt);
$new_user_notif_txt = str_replace("[email]", $data['user_email'], $new_user_notif_txt);
$new_user_notif_txt = str_replace("[user_link]", $settings['forum_address'] . "index.php?mode=user&show_user=" . $id, $new_user_notif_txt);
$new_user_notif_txt = stripslashes($new_user_notif_txt);
// who gets a notification?
$admin_result = @mysql_query("SELECT user_name, user_email FROM " . $db_settings['userdata_table'] . " WHERE user_type>0 AND new_user_notification=1", $connid);
if (!$admin_result) {
raise_error('database_error', mysql_error());
}
while ($admin_array = mysql_fetch_array($admin_result)) {
$ind_reg_emailbody = str_replace("[recipient]", $admin_array['user_name'], $new_user_notif_txt);
$admin_mailto = my_mb_encode_mimeheader($admin_array['user_name'], CHARSET, "Q") . " <" . $admin_array['user_email'] . ">";
my_mail($admin_mailto, $lang['new_user_notif_sj'], $ind_reg_emailbody);
}
}
if ($settings['register_mode'] == 1) {
header("Location: index.php?mode=login&login_message=account_activated_but_locked");
} else {
header("Location: index.php?mode=login&login_message=account_activated");
}
exit;
} else {
$error = true;
}
}
if (isset($error)) {
$smarty->assign('lang_section', 'register');
$smarty->assign('message', 'activation_failed');
示例13: date
/*session_start();
if (!empty($_POST['validator']) && $_POST['validator'] == $_SESSION['rand_code']) {
//return false;*/
/////////////////////////////////////////
include "libs_mail.php";
$data_crt = date("Y-m-d H:i:s");
$from = "{$_POST['fio']}";
$headers = "From: {$from}";
$subject = "Вопрос от {$_POST['fio']}";
$msg = "Контактные данные\n\n";
$msg = $msg . "Имя - {$_POST['fio']}\n";
$msg = $msg . "Телефон - {$_POST['phone']}\n";
$msg = $msg . "E-mail - {$_POST['eml_user']}\n\n";
$msg = $msg . "Вопрос:\n {$_POST['text']}";
if ($_POST[fio] or $_POST[text] or $_POST[eml_user] or $_POST[phone]) {
my_mail($headers, $subject, $msg, "zakaz@pechati.ru");
//my_mail($headers, $subject, $msg, "zakaz@pechati.ru");
//my_mail($headers, $subject, $msg, "zaicev_cpi@mail.ru");
Header("Location: faq_send.html");
exit;
} else {
Header("Location: faq_send.html");
exit;
}
/* unset($_SESSION['rand_code']);
/////////////////////////////////////////
} elseif($_POST) {
// return true;
Header("Location: faq_send.html");
exit;
示例14: mysql_free_result
}
mysql_free_result($pwf_result);
}
if (empty($error)) {
$pwf_code = random_string(32);
$pwf_code_hash = generate_pw_hash($pwf_code);
$update_result = mysql_query("UPDATE " . $db_settings['userdata_table'] . " SET last_login=last_login, registered=registered, pwf_code='" . mysql_real_escape_string($pwf_code_hash) . "' WHERE user_id = " . intval($field['user_id']) . " LIMIT 1", $connid);
// send mail with activating link:
$smarty->config_load($settings['language_file'], 'emails');
$lang = $smarty->get_config_vars();
$lang['pwf_activating_email_txt'] = str_replace("[name]", $field["user_name"], $lang['pwf_activating_email_txt']);
$lang['pwf_activating_email_txt'] = str_replace("[forum_address]", $settings['forum_address'], $lang['pwf_activating_email_txt']);
$lang['pwf_activating_email_txt'] = str_replace("[activating_link]", $settings['forum_address'] . basename($_SERVER['PHP_SELF']) . "?mode=login&activate=" . $field["user_id"] . "&code=" . $pwf_code, $lang['pwf_activating_email_txt']);
$lang['pwf_activating_email_txt'] = stripslashes($lang['pwf_activating_email_txt']);
$pwf_mailto = my_mb_encode_mimeheader($field["user_name"], CHARSET, "Q") . " <" . $field["user_email"] . ">";
if (my_mail($pwf_mailto, $lang['pwf_activating_email_sj'], $lang['pwf_activating_email_txt'])) {
header("location: index.php?mode=login&login_message=mail_sent");
exit;
} else {
header("Location: index.php?mode=login&login_message=mail_error");
exit;
}
}
header("Location: index.php?mode=login&login_message=pwf_failed");
exit;
break;
case "activate":
if (isset($_GET['activate']) && trim($_GET['activate']) != "" && isset($_GET['code']) && trim($_GET['code']) != "") {
$pwf_result = mysql_query("SELECT user_id, user_name, user_email, pwf_code FROM " . $db_settings['userdata_table'] . " WHERE user_id = '" . intval($_GET["activate"]) . "'", $connid);
if (!$pwf_result) {
raise_error('database_error', mysql_error());
示例15: my_mail
$checking_mail = my_mail($mail);
if ($checking_pass == true and $checking_nsm == true and $checking_mail == true) {
echo "Вітаємо ви були зареєстровані на сайті!";
$query = mysql_query("INSERT INTO users(login, mail, name, surname, password, position, type) VALUES ('{$login}', '{$mail}', '{$name}', '{$surname}', '{$l_password}', '{$position}', '{$type}' )");
}
?>
</div>
<div id="register_field_right">
<?php
if ($_POST['submit']) {
if ($checking_pass == false or $checking_nsm == false or $checking_mail == false) {
echo '<p id="register_error_title">Вииникли помилки при реєстрації</p>';
echo '<p id="register_error">';
$checking_pass = pass($l_password, $r_password);
$checking_nsm = check_nsm($name, $surname, $login);
$checking_mail = my_mail($mail);
if ($checking_pass == false) {
echo "Поля з паролем мають бути заповненні.<br>";
echo "Пароль має містити щонайменше 6 символів.<br>";
echo "Паролі не співпадають.<br>";
}
if ($checking_mail == false) {
echo "Не правильно вказано E-mail.<br>";
}
echo '</p>';
}
}
?>
</div>
</div>