本文整理汇总了PHP中Mail::send_mail方法的典型用法代码示例。如果您正苦于以下问题:PHP Mail::send_mail方法的具体用法?PHP Mail::send_mail怎么用?PHP Mail::send_mail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mail
的用法示例。
在下文中一共展示了Mail::send_mail方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: solve_combats
/**
* résolution des combats (chargé depuis index.php)
**/
public function solve_combats()
{
// identification de l'attaquant et du défenseur
$attacker = new User($this->attacker_id);
$defender = new User($this->target_id);
// ... et de leur armée
$army_att = new Army($this->attacker_id, $this->id);
$army_def = new Army($this->target_id);
// affichage de l'armée attaquante
$mess_att = '';
foreach ($army_att->troops as $unit) {
if ($unit->quantity > 0) {
$mess_att .= '<li>' . $unit->quantity . ' ' . $unit->name . '</li>';
}
}
// affichage de l'armée en défence
$mess_def = '';
if ($army_def->total_units > 0) {
foreach ($army_def->troops as $unit) {
$mess_def .= '<li>' . $unit->quantity . ' ' . $unit->name . '</li>';
}
} else {
$mess_def .= "<li>Il n'y avait personne pour défendre cet empire</li>";
}
$message = "<table><tr>" . "<th style=\"width:50%\">Attaquant : {$attacker->pseudo}<br>flotte : {$army_att->total_units} unité(s)</th>" . "<th style=\"width:50%\">Défenseur : {$defender->pseudo}<br>flotte : {$army_def->total_units} unité(s)</th>" . "</tr><tr><td><ul>{$mess_att}</ul></td><td><ul>{$mess_def}</ul></td></tr>";
if ($army_def->total_units > 0) {
// résolution du combat en 6 tours (on boucle tant qu'il reste des unités à un joueur
$i = 0;
while ($i < 6 && $army_att->total_units > 0 && $army_def->total_units > 0) {
$i++;
// il faut temporiser les dégats de l'attaquant pour qu'il puisse attaquer de toute sa force
// car va lui détruire des unités dès sa première attaque
$dommages = $army_def->total_damage;
$def_res = $army_def->split_damage($army_att->total_damage);
$att_res = $army_att->split_damage($dommages);
$message .= "<tbody><tr><th colspan=\"2\">Tour {$i}</th></tr><tr><td>{$att_res}</td><td>{$def_res}</td></tr></tbody>";
}
}
// résultat du combat
if ($army_def->total_units <= 0) {
$available = round($defender->ressources / 3);
$can_take = round($army_att->total_life);
$amount = $available - $can_take > 0 ? $can_take : $available;
$attacker->increase_ressource($amount);
$defender->increase_ressource(-$amount);
$result = 'Vainqueur : ' . $attacker->pseudo . '<br>Ressources pillées : ' . $amount;
} elseif ($army_att->total_units <= 0) {
$result = 'Vainqueur : ' . $defender->pseudo;
} else {
$result = 'Aucun vainqueur';
}
$message .= "<tr><td colspan='2'>{$result}</td></tr></table>";
$this->reset_army();
// envoi les rapports de combats
$mail = new Mail();
$mail->send_mail($attacker->id, $message, 'Rapport de combat (' . $defender->pseudo . ')');
// on changer uniquement le destinataire et on le renvoi
$mail->recipient = $defender->id;
$mail->add();
}
示例2: fw_orders_products
$products_list .= $_SESSION['fw_basket'][$i]['id'] . '|' . $_SESSION['fw_basket'][$i]['number'] . ',';
$total_number = $total_number + $_SESSION['fw_basket'][$i]['number'];
$rel_prod[] = "('" . $_SESSION['fw_basket'][$i]['id'] . "','" . $order_id . "','" . $_SESSION['fw_basket'][$i]['number'] . "')";
}
$db->query("INSERT INTO fw_orders_products (product_id,order_id,product_count) VALUES " . implode(",", $rel_prod));
$_SESSION['fw_basket'] = array();
$smarty->assign("name", $_SESSION['fw_user']['name']);
$smarty->assign("site_url", BASE_URL);
$smarty->assign("date", time());
$smarty->assign("order_total", $total_price);
$smarty->assign("number", $total_number);
$smarty->assign("currency", DEFAULT_CURRENCY);
$body = $smarty->fetch($templates_path . '/order_notice.txt');
Mail::send_mail(SEND_ORDER_TO, ADMIN_MAIL, "Новый заказ в интернет магазине", $body, '', 'text', 'standard', 'Windows-1251');
$admin_body = $smarty->fetch($templates_path . '/admin_order_notice.txt');
Mail::send_mail(ADMIN_MAIL, ADMIN_MAIL, "Новый заказ в интернет магазине", $admin_body, '', 'text', 'standard', 'WIndows-1251');
$page_found = true;
$template = 'order_done.html';
}
} else {
header("Location: " . BASE_URL);
}
break;
case count($url) == 2 && preg_match("/\\?search_product=(.+)\$/", $url[$n]) or count($url) == 2 && preg_match("/\\?search_product=(.+)&page=([1-9]+)\$/", $url[$n]):
$navigation[] = array("url" => 'search', "title" => 'Поиск');
$search = mysql_real_escape_string($_GET['search_product']);
$search = urldecode($search);
$current_url_pages[$n] = eregi_replace("&page=([1-9]+)", "", $current_url_pages[$n]);
if (isset($_GET['page']) && $_GET['page'] != '') {
$page = $_GET['page'];
} else {
示例3: header
header("Location: index.php?mod=guestbook");
die;
}
if (isset($_POST['submit_edit_message'])) {
$id = $_POST['id'];
$text = Common::strip_forum_tags($_POST['message_text']);
$author = $_POST['message_author'];
$mail = $_POST['message_author_mail'];
$answer = Common::strip_forum_tags($_POST['message_answer']);
$db->query("UPDATE fw_guestbook SET author='{$author}',author_mail='{$mail}',message='{$text}',answer='{$answer}' WHERE id='{$id}'");
if (isset($_POST['send_answer']) && $mail != '') {
$smarty->assign("site_url", BASE_URL);
$smarty->assign("message", $text);
$smarty->assign("answer", $answer);
$body = $smarty->fetch(BASE_PATH . '/modules/guestbook/answer_template.txt');
Mail::send_mail($mail, ADMIN_MAIL, "ќтвет на ваше сообщение", $body, '', 'html', 'standard', 'Windows-1251');
}
$smarty->assign("refresh_parent", "true");
}
/*--------------------------------- ќ“ќЅ–ј∆≈Ќ»≈ ------------------------------*/
switch (TRUE) {
case $action == 'add':
$navigation[] = array("url" => BASE_URL . "/admin/?mod=guestbook&action=add", "title" => 'ƒобавить собщение');
$smarty->assign("mode", "add");
$template = 'guestbook.a_edit.html';
break;
case $action == 'edit' && isset($_GET['id']):
Common::check_priv("{$priv}");
$id = $_GET['id'];
$message = $db->get_single("SELECT * FROM fw_guestbook WHERE id='{$id}' LIMIT 1");
$message['message'] = Common::add_forum_tags($message['message']);
示例4: Army
if (!User::isLogged()) {
$errors[] = "erreur vous n'êtes plus connecté";
} else {
$army_owned = new Army($user->id);
$mails = Mail::get_mails($user->id);
$queues = $queue->get_all_queues();
if (!empty($_POST) && isset($_POST['ajax'])) {
switch ($_POST['action']) {
case 'mark_as_read':
$mail = new Mail(intval($_POST['item_id']));
$mail->update_value('unread', 0);
break;
case 'send_mail':
$mail = new Mail();
echo $mail->send_mail($_POST['to'], $_POST['content'], $_POST['topic'], $user->id);
break;
case 'delete_mail':
$mail = new Mail(intval($_POST['item_id']));
$mail->delete();
break;
case 'add_to_queue':
if (count($queues) < $queue->get_queue_limit()) {
$unit_id = intval($_POST['unit_id']);
$quantity = intval($_POST['quantity']);
$price = round($army_owned->troops[$unit_id]->price * $quantity);
$building_time = round($army_owned->troops[$unit_id]->building_time * $quantity);
if ($price <= $user->ressources) {
$item_added = $queue->add_to_queue($unit_id, $user->id, $quantity, $building_time);
$new_ressources = $user->increase_ressource(-$price);
echo json_encode(['status' => 'ok', 'new_ressources' => $new_ressources, 'queue' => $item_added]);
示例5: fw_guestbook
$smarty->assign("error_message", "Введённый e-mail имеет неправильный формат");
} else {
$mail = $_POST['nm_mail'];
}
$text = Common::strip_forum_tags($_POST['nm_text']);
if ($check) {
if (GB_PREMODERATION == 'on') {
$status = '0';
} else {
$status = '1';
}
$db->query("INSERT INTO fw_guestbook(author,message,insert_date,author_mail,status) VALUES('{$author}','{$text}','" . time() . "','{$mail}','{$status}')");
$body = $smarty->fetch(BASE_PATH . '/modules/guestbook/admin_mail_template.txt');
$headers = "Content-type: text/html; charset=windows-1251 \r\n";
$headers .= "From: <" . BASE_URL . ">\r\n";
Mail::send_mail($mail, ADMIN_MAIL, "Новое сообщение на сайте " . BASE_URL, $body, "", "text", "standard", "windows-1251");
$location = $_SERVER['HTTP_REFERER'];
header("Location: {$location}");
}
}
if (preg_match("/^page_([0-9]+)\$/", $url[$n])) {
list(, $page) = explode("_", $url[$n]);
$url = array_values($url);
unset($url[$n]);
unset($current_url_pages[count($current_url_pages) - 1]);
} else {
$page = 1;
}
switch (TRUE) {
case count($url) == 1:
$page_found = true;
示例6: array
if ($switch_default == 'on' or $switch_support == 'on') {
$smarty->assign("otr_list_support", $db->get_all("SELECT * FROM fw_otr ORDER BY title ASC"));
$smarty->assign("otr_url", $support_url);
}
if ($main_module == 'on') {
require_once 'lib/class.photoalbum.php';
require_once 'lib/class.table.php';
require_once 'lib/class.form.php';
require_once 'lib/class.mail.php';
$navigation[] = array("url" => $module_url, "title" => $node_content['name']);
if (isset($_POST['submit_otr_comment'])) {
$name = $_POST['user_name'];
$email = $_POST['user_mail'];
$msg = $_POST['user_msg'];
Mail::send_mail(ADMIN_MAIL, ADMIN_MAIL, "—ообщение из раздела 'ќтраслевые решени¤'", $msg, '', 'text', 'standard', 'WIndows-1251');
$smarty->assign("send_msg", "¬аше сообщение отправлено администратору сайта. —пасибо.");
}
switch (TRUE) {
case count($url) == 1:
$page_found = true;
$otr_list = $db->get_all("SELECT * FROM fw_otr ORDER BY title ASC");
$smarty->assign("otr_list", $otr_list);
$template = 'otr_list.html';
break;
case $url[$n] == 'archive' && count($url) == 2 || $url[$n - 1] == 'archive' && preg_match("/^page_([0-9]+)\$/", $url[$n]) && count($url) == 3:
$page_found = true;
$navigation[] = array("url" => "archive", "title" => "јрхив");
if (preg_match("/^page_([0-9]+)\$/", $url[$n])) {
list(, $page) = explode("_", $url[$n]);
$url = array_values($url);
示例7: COUNT
$to = $check_user['id'];
}
if ($check) {
$messages_count = $db->get_single("SELECT COUNT(*) AS count FROM fw_messages WHERE `to`='{$to}'");
if ($messages_count['count'] >= MAX_MESSAGES) {
$db->query("DELETE FROM fw_messages WHERE `to`='{$to}' ORDER BY publish_date LIMIT 1");
}
$db->query("INSERT INTO fw_messages(`from`,`to`,`subject`,`text`,`publish_date`) VALUES('{$from}','{$to}','{$subject}','{$text}','" . time() . "')");
if ($check_user['mail'] != '') {
$smarty->assign("site_url", BASE_URL);
$smarty->assign("answer_url", BASE_URL . '/users/messages/new/?to=' . $from);
$smarty->assign("cabinet_url", BASE_URL . '/cabinet/');
$smarty->assign("author", $_SESSION['fw_user']['name']);
$smarty->assign("message", $text);
$message_body = $smarty->fetch($templates_path . '/new_message_notification.txt');
Mail::send_mail($check_user['mail'], ADMIN_MAIL, "Новое личное сообщение на сайте " . BASE_URL, $message_body, "", "text", "standard", "windows-1251");
}
$smarty->assign("message", "Сообщение отправлено");
}
}
if (count($url) == 4 && $url[$n - 2] == 'messages' && $url[$n - 1] == 'delete') {
$page_found = true;
$id = $url[$n];
$db->query("DELETE FROM fw_messages WHERE id='{$id}' AND (`to`='" . $_SESSION['fw_user']['id'] . "' OR `from`='" . $_SESSION['fw_user']['id'] . "')");
$location = $_SERVER['HTTP_REFERER'];
header("Location: {$location}");
}
if (isset($_POST['submit_edit_albums'])) {
$sort_order = $_POST['sort_order'];
foreach ($sort_order as $k => $v) {
if (preg_match("/^[0-9]*\$/", String::secure_user_input($v))) {
示例8: preg_replace
$smarty->assign("delivery", $delivery);
$smarty->assign("user", $user);
$smarty->assign("phone", $phone);
$smarty->assign("address", $address);
$smarty->assign("comment", $comment);
$smarty->assign("email", $email);
$smarty->assign("currency", DEFAULT_CURRENCY);
if ($orderPromo) {
$shop->setUserDataByPromo($code, preg_replace("/\\D/", "", $phone), $email, $order_id);
}
if (!empty($email)) {
$body = $smarty->fetch($templates_path . '/order_notice.txt');
Mail::send_mail($email, MAIL_FROM, "Новый заказ в интернет магазине", $body, '', 'html', 'standard', 'Windows-1251');
}
$admin_body = $smarty->fetch($templates_path . '/admin_order_notice.txt');
Mail::send_mail(SEND_ORDER_TO, MAIL_FROM, "Новый заказ в интернет магазине", $admin_body, $attach, 'html', 'standard', 'WIndows-1251');
header("Location: /catalog/basket/final/");
die;
}
} else {
header("Location: " . BASE_URL);
}
break;
case count($url) == 2 && preg_match("/\\?search_product=(.*)\$/", $url[$n]) or count($url) == 2 && preg_match("/\\?search_product=(.+)&page=([1-9]+)\$/", $url[$n]):
$navigation[] = array("url" => 'search', "title" => 'Поиск');
$search = filter_var(trim($_GET['search_product']), FILTER_SANITIZE_STRING);
$search = urldecode($search);
$current_url_pages[$n] = eregi_replace("&page=([1-9]+)", "", $current_url_pages[$n]);
if (isset($_GET['page']) && $_GET['page'] != '') {
$page = $_GET['page'];
} else {
示例9: foreach
if (isset($_POST['element'])) {
foreach ($_POST['submit_form_id'] as $key => $value) {
$form = $db->get_single("SELECT * FROM fw_forms WHERE id='" . $key . "' AND status='1'");
if ($form['email'] != '') {
$elements = $db->get_all("SELECT * FROM fw_forms_elements WHERE parent='" . $key . "' AND status='1' ORDER BY sort_order");
$values_array = array();
foreach ($_POST['element'][$key] as $k1 => $v1) {
$values_array[$k1] = $v1;
}
foreach ($elements as $k => $v) {
if (substr($v['name'], 0, 1) == "*" && substr($v['name'], -1) == "*") {
$elements[$k]['name'] = substr($v['name'], 1, -1);
}
if ($v['type'] == 0) {
$elements[$k]['value'] = "";
} else {
$elements[$k]['value'] = nl2br($values_array[$v['id']]);
}
}
$smarty->assign("form", $form);
$smarty->assign("elements", $elements);
$body = $smarty->fetch(BASE_PATH . '/modules/forms/templates/mail.txt');
if (Mail::send_mail($form['email'], ADMIN_MAIL, "Заполнена форма на сайте", $body, '', 'html', 'standard', 'Windows-1251')) {
$smarty->assign("result_text", "Форма успешно отправлена. Спасибо.");
} else {
$smarty->assign("result_text", "Произошла ошибка при отправлении формы. Повторите, пожалуйста, ввод.");
}
}
}
}
}
示例10: err
//Дергаем функцию для проверки на ошибки и присваиваем массив $err
$err = err($_POST);
#Если ошибки отсутствуют обращаемся к бд
if (!count($err)) {
#Проверяем имеется ли данный логин в базе
$login = q("\n SELECT *\n FROM `users`\n WHERE `login` = '" . ms($_POST['login']) . "'\n LIMIT 1\n ");
if (mysqli_num_rows($login)) {
$err['login'] = 'Такой логин уже существует';
}
#Проверяем имеется ли данное мыло в базе
$email = q("\n SELECT *\n FROM `users`\n WHERE `email` = '" . ms($_POST['email']) . "'\n LIMIT 1\n ");
if (mysqli_num_rows($email)) {
$err['email'] = 'Пользователь с таким email уже существует';
}
}
#Если нету ошибок
if (!count($err)) {
#Экранируем массив $_POST
$_POST = ms($_POST);
#Если нету вносим нового пользователя
q("\n INSERT\n INTO `users`\n SET\n `login` = '" . $_POST['login'] . "',\n `password` = '" . myHash($_POST['password']) . "',\n `email` = '" . $_POST['email'] . "',\n `age` = '" . $_POST['age'] . "',\n `hash` = '" . myHash(md5($_POST['login'] . $_POST['email'])) . "',\n `registration_date` = NOW()\n ");
#Формируем и отправляем активационное письмо на указанный ранее адрес
Mail::$to = $_POST['email'];
Mail::$subject = 'Подтвердите регистрацию аккаунта на сайте' . Core::$DOMAIN;
Mail::$message = 'Для подтверждения регистрации перейдите по ссылке ' . Core::$DOMAIN . 'index.php?module=cab&page=active&code=' . myHash(md5($_POST['login'] . $_POST['email']));
Mail::send_mail();
$_SESSION['regok'] = 'OK';
header("Location: index.php?module=cab&page=reg");
exit;
}
}
示例11: foreach
$smarty_tmp['text'] = $_POST['np_text'];
$smarty->assign("tmp", $smarty_tmp);
$check = false;
}
if ($check) {
$parent = String::secure_user_input($_POST['thread_id']);
$get_subscribers = $db->get_all("SELECT * FROM fw_send_forum_answers WHERE thread_id='{$parent}'");
//Common::dumper($get_subscribers,1);
if (count($get_subscribers) > 0) {
$smarty->assign("site_url", BASE_URL);
$smarty->assign("message", $thread['message']);
$smarty->assign("reply", $_POST['np_text']);
$smarty->assign("thread_url", $_SERVER['HTTP_REFERER']);
$message = $smarty->fetch(BASE_PATH . '/modules/forum/front/templates/send_answer.txt');
foreach ($get_subscribers as $k => $v) {
Mail::send_mail($v['mail'], ADMIN_MAIL, 'Новое сообщение в форуме', $message, '', 'text', 'standard', 'Windows-1251');
}
}
$text = strip_forum_tags($_POST['np_text']);
if (FORUM_PREMODERATION == 'on') {
$set_status = '1';
} else {
$set_status = '1';
}
$db->query("INSERT INTO fw_forum_posts(parent,author,text,publish_date,status) VALUES('{$parent}','{$author}','{$text}','" . time() . "','{$set_status}')");
$location = $_SERVER['HTTP_REFERER'];
header("Location: {$location}");
}
}
//----------------------------- ОТОБРАЖЕНИЯ КОНТЕНТА -------------------------------
switch (TRUE) {
示例12: count
$smarty->assign("success_message", "На указанный вами адрес был выслан активационный код с дальнейшими инструкциями.");
} else {
$smarty->assign("success_message", "Адрес успешно добавлен в базу рассылки!");
}
}
if ($action == 'unsubscribe') {
$check_subscriber = $db->get_single("SELECT mail,reg_date FROM fw_subscribe_list WHERE mail='{$mail}'");
if ($check_subscriber['mail'] == '') {
$check = false;
$smarty->assign("error_message", "Извините, этого адреса не существует.");
}
if ($check) {
$smarty->assign("site_url", BASE_URL);
$smarty->assign("activation_link", BASE_URL . '/' . $node_content['url'] . '/unsubscribe_confirm/' . $check_subscriber['reg_date']);
$body = $smarty->fetch(BASE_PATH . '/modules/subscribe/submit_unsubscribe.txt');
@Mail::send_mail($check_subscriber['mail'], ADMIN_MAIL, 'Подтверждение отписки от рассылки', $body, '', 'html', 'standard', 'Windows-1251');
$smarty->assign("success_message", "На указанный адрес был выслан код подтверждения отписки от рассылки с дальнейшими инструкциями");
}
}
}
$template = 'subscribe_main.html';
break;
case $url[$n - 1] == 'subscribe_confirm' && preg_match("/^[0-9]*\$/", $url[$n]) && count($url) == 3:
$page_found = true;
$navigation[] = array("url" => 'subscribe_confirm', "title" => 'Подтверждение подписки');
$code = $url[$n];
$check_code = $db->get_single("SELECT id FROM fw_subscribe_list WHERE status='0' && reg_date='{$code}'");
if ($check_code['id'] == '') {
$smarty->assign("message", "Извините, но ваш активационный код недействиетелен");
} else {
$db->query("UPDATE fw_subscribe_list SET status='1' WHERE reg_date='{$code}'");
示例13: foreach
$text = $_POST['mail_text'];
$subj = $_POST['mail_subj'];
$type = $_POST['send_type'];
$group_id = $_POST['send_to'];
$template_id = $_POST['mail_template'];
if ($group_id == '0') {
$users_list = $db->get_all("SELECT mail FROM fw_subscribe_list WHERE status='1'");
} else {
$users_list = $db->get_all("SELECT mail FROM fw_subscribe_list WHERE status='1' AND group_id='{$group_id}'");
}
$mail_template = $db->get_single("SELECT template FROM fw_subscribe_templates WHERE id='{$template_id}'");
$smarty->assign("text", $text);
$smarty->assign("mail_content", $mail_template['template']);
$body = $smarty->fetch(BASE_PATH . '/modules/subscribe/template.txt');
foreach ($users_list as $k => $v) {
Mail::send_mail($v['mail'], ADMIN_MAIL, $subj, $body, '', $type, SUBSCRIBE_TRANSPORT_METHOD, SUBSCRIBE_ENCODING);
}
}
if ($action == "change_user_status" && isset($_GET['id'])) {
$id = intval($_GET['id']);
$db->query("UPDATE fw_subscribe_list SET status=IF(status='0','1','0') WHERE id='" . $id . "'");
$location = $_SERVER['HTTP_REFERER'];
header("Location: {$location}");
die;
}
if ($action == 'delete_inactive_users') {
$limit_date = time() - 604800;
$db->query("DELETE FROM fw_subscribe_list WHERE reg_date<{$limit_date} AND status='0'");
$location = $_SERVER['HTTP_REFERER'];
header("Location: {$location}");
}