public function indexAction() { //$name = F::$f->Model_User->getName(); //echo $name; //Logging::logMessage('我写入的日子1222', Logging::LEVEL_ERROR, 'hahaha'); //$this->mdisplay('test/index.tpl'); //$this->massign("name", "canyou"); //$this->mdisplay('test/index.tpl'); $email_contents = file_get_contents(ROOT . '/../resource/email/reg.html'); $email_contents = str_replace("{0}", '快来顶我吧', $email_contents); $email_contents = str_replace("{1}", date('Y'), $email_contents); //Helper_Mail::SendSysMail($request_email, gettext('中移物联网-设备云注册'), $email_contents); $res = Helper_Mail::SendSysMail('*****@*****.**', gettext('招商银行推出新BB了,快来瞧啊!!'), $email_contents); var_dump($res); }
/** * Генерируем служебную почту (если она не была сгенерирована) */ function create_service_mail() { $mail = _Core_Request::getCurrent()->post['mail']; $user = Core::getInstance()->user; if (Helper_Mail::validateEmail($mail)) { if ($this->model->checkServiceEmailIsUnique($mail)) { if ($this->model->createServiceMail($user, $mail)) { $this->tpl->assign('result', array('text' => 'Email успешно создан')); } } else { $this->tpl->assign('error', array('text' => "Придумайте другой email.\nЭтот email уже занят")); } } else { $this->tpl->assign('error', array('text' => 'Используйте только английские буквы и цифры')); } }
/** * Создаём нового пользователя * @param $args array mixed * @return void */ function new_user() { $login = isset($_POST['login']) ? trim((string) $_POST['login']) : ''; $password = isset($_POST['password']) ? trim((string) $_POST['password']) : ''; $confirm_password = isset($_POST['confirm_password']) ? trim((string) $_POST['confirm_password']) : ''; $name = isset($_POST['name']) ? trim((string) $_POST['name']) : ''; $mail = isset($_POST['mail']) ? trim((string) $_POST['mail']) : ''; // Проверяем валидность заполненных данных if (!empty($password) && !empty($confirm_password)) { if ($password === $confirm_password) { $sha1_password = SHA1($password); } else { $this->_error['pass'] = "******"; } } else { $this->_error['pass'] = "******"; } if (!$this->validate_login($login)) { $this->_error['login'] = "******"; } $login = htmlspecialchars($login); if (!Helper_Mail::validateEmail($mail)) { $this->_error['mail'] = "Неверно введен e-mail!"; } $mail = htmlspecialchars($mail); // Проверить наличие пользователя // TODO: model->exist_user() готовит собщение об ошибке - надо перенести сюда $this->model->exist_user($login, $mail); // Если нет ошибок создать и авторизовать пользователя $errors = array_merge($this->model->getErrors(), $this->_error); if (!$errors) { // Создать пользователя $this->model->new_user($name, $login, $password, $confirm_password, $mail); // Отправить ему уведомление с реквизитами $this->_send_mail_success($name, $login, $password, $mail); $user = Core::getInstance()->user; if (!$user->initUser($login, $sha1_password)) { $this->_output(array('error' => array('text' => 'Некорректный логин или пароль!'))); } // Авторизовать пользователя $this->_authenticateUser($login, $sha1_password); $answer = array('result' => array('text' => 'Спасибо, вы зарегистрированы!', 'redirect' => URL_ROOT_MAIN . "my/review/")); } else { $answer = array('error' => array('text' => implode('<br />', $errors))); } $this->_output($answer); }
static function sendWatchEmail($controller, $watch, $product) { $itemTitle = $product->getTitle(); $from = $controller->getNoReplyFrom(); $memberId = $watch->getMemberId(); if (is_numeric($memberId)) { $member = $controller->getSingleObject('members', 'getMemberById', array($memberId)); } else { $member = $controller->getSingleObject('members', 'getMemberByEmail', array($memberId)); if (!$member) { $member = self::_createFakeMemberFromEmail($memberId); } } if (!$member) { return; } $to = $member->getEmail(); $body = self::getStockAvailableEmailBody($controller, $product, $member); Helper_Mail::sendEmailWithFooter($controller, $from, $to, NULL, NULL, "Item Available: {$itemTitle}", $body); }
/** * @dataProvider planForValidateEmail */ public function testValidateEmail($mail, $bool) { $this->assertEquals(Helper_Mail::validateEmail($mail), $bool); }
static function cancelOrder($controller, $order, $setRemarks = NULL) { if (isset($setRemarks)) { $order->setRemarks($setRemarks); } $withCancelOrders = $controller->getKrcoConfigValue('cart', 'with_cancel_orders'); if ($withCancelOrders === FALSE) { return; } if ($order->getOrderStatus() == 'Cancelled') { return; } $currentStatus = $order->getOrderStatus(); $order->setOrderStatus('Cancelled'); $controller->dbCall('orders', 'updateOrder', array($order), TRUE); $orderedProds = $order->getOrderedProducts(); foreach ($orderedProds as $orderedProd) { $item = self::_orderedProdToItem($orderedProd); Helper_Cart::_subtractProductStock($item, $controller, TRUE); } $memberObj = $controller->getMemberOfOrder($order); $controller->_processMemberPlaceOrder($order, $memberObj, TRUE); //revert back point earned if any if ($currentStatus == 'Processing') { self::_setMemberPoint($controller, $order, $memberObj, TRUE); } $signature = $controller->_getEmailSignature(); $from = $controller->getNoReplyFrom(); $to = $controller->getOrdersEmailAddress(); $orderId = $order->getLongId(); $orderManageLine = Helper_Krco::getOrderManageLine($controller, $order); $body = <<<EOD <p> Dear Admin, </p> <p> This is to notify that the Order with ID {$orderId} is expired. </p> <p> {$orderManageLine} </p> {$signature} EOD; Helper_Mail::sendEmail($controller, $from, $to, NULL, NULL, "Expired Order: {$orderId}", $controller->_getHtmlEmailBody($body)); $name = $order->getRecipientName(); $userBody = $controller->_getOrderExpiredEmailBodyToUser($order); $smsBody = $controller->getOrderExpiredSmsBodyToUser($order); $emails = $controller->_getOrderEmails($order); Helper_Mail::sendEmailWithFooter($controller, $from, $emails['to'], $emails['cc'], NULL, "Expired Order: {$orderId}", $userBody); Helper_Mail::sendSms($controller, $order->getRecipientPhoneNumber(), $smsBody); }
$req = $bdd->prepare('SELECT email FROM aide LEFT JOIN etudiant ON aide.numero_etudiant = etudiant.numero_etudiant WHERE aide.id_needhelp = :idannonce'); $req->execute(array('idannonce' => $_POST["idannonce"])) or die(print_r('2' . $bdd->errorInfo(), true)); $helper = $req->fetch(); $refus1 = new Template("../templates/mail.tpl"); $refus1->set("annonce", $demandeur["commentaire"]); $refus1->set("text", "Vous avez refuse l'aide pour l'annonce "); $refus1->set("url", "https://media.giphy.com/media/Hwq45iwTIUBGw/giphy.gif"); $mail_demandeur = new Helper_Mail(); $mail_demandeur->to($demandeur["email"])->sujet("Refus d'aide")->content($refus1->output())->send(); $refus2 = new Template("../templates/mail.tpl"); $refus2->set("annonce", $demandeur["commentaire"]); $refus2->set("text", "Un etudiant a refuse votre demande d'aide pour l'annonce "); $refus2->set("url", "http://www.reactiongifs.com/r/d9.gif"); $mail_helper = new Helper_Mail(); $mail_helper->to($helper["email"])->sujet("Refus d'aide")->content($refus2->output())->send(); $req = $bdd->prepare('UPDATE needhelp SET etat = 0 WHERE id = :idannonce '); $req->execute(array('idannonce' => $_POST["idannonce"])) or die('3' . print_r($bdd->errorInfo(), true)); $req = $bdd->prepare('DELETE FROM aide WHERE id_needhelp = :idannonce '); $req->execute(array('idannonce' => $_POST["idannonce"])) or die('4' . print_r($bdd->errorInfo(), true)); } else { echo "not ok lol"; }
} //On remet la demande d'aide à l'état d'origine $reqBis = $bdd->prepare('UPDATE needhelp SET etat=0 WHERE id IN(SELECT id_needhelp FROM aide WHERE etat=0 AND numero_etudiant= :iduser1)'); $reqBis->execute(array('iduser1' => $_POST["iduser"])) or die(print_r('3' . $bdd->errorInfo(), true)); $req = $bdd->prepare('DELETE FROM aide WHERE numero_etudiant = :iduser'); $req->execute(array('iduser' => $_POST["iduser"])) or die(print_r('4' . $bdd->errorInfo(), true)); //fin partie suppression proposeur aide //partie suppression demandes //On recupère les etudiants qui voulaient aider l'élève qui va être supprimer $reqBis = $bdd->prepare('SELECT numero_etudiant FROM aide WHERE etat=0 and id_needhelp in(SELECT id FROM needhelp WHERE etat=1 AND numero_etudiant= :iduser)'); $reqBis->execute(array('iduser' => $_POST["iduser"])) or die(print_r('6' . $bdd->errorInfo(), true)); $resultat = $reqBis->fetchAll(); //Ensuite on envoie un mail pour prévenir ces personnes foreach ($resultat as $r) { $req = $bdd2->prepare('SELECT email,nom,prenom FROM etudiant WHERE numero_etudiant= :iduser2'); $req->execute(array('iduser2' => $r['numero_etudiant'])) or die(print_r('7' . $bdd2->errorInfo(), true)); $resultatfind = $req->fetch(); // Envoi du mail $mail_demandeur = new Helper_Mail(); $mail_demandeur->to($resultatfind['email'])->sujet('Annulation echange')->content("Bonjour " . $resultatfind['prenom'] . " " . $resultatfind['nom'] . " .Malheuresement, nous avons banni un élève que vous souhaitiez aider :\n nous avons donc interrompu l'echange en cours.N'hésitez pas à aider d'autres personnes. Bonne journée !")->send(); } $req = $bdd->prepare('DELETE FROM aide WHERE id_needhelp IN(SELECT id from needhelp where numero_etudiant = :iduser)'); $req->execute(array('iduser' => $_POST["iduser"])) or die(print_r('8' . $bdd->errorInfo(), true)); $req = $bdd->prepare('DELETE FROM needhelp WHERE numero_etudiant = :iduser'); $req->execute(array('iduser' => $_POST["iduser"])) or die(print_r('9' . $bdd->errorInfo(), true)); //fin supression demandes $req = $bdd->prepare('DELETE FROM helper WHERE numero_etudiant = :iduser'); $req->execute(array('iduser' => $_POST["iduser"])) or die(print_r('5' . $bdd->errorInfo(), true)); $req = $bdd->prepare('DELETE FROM etudiant WHERE numero_etudiant = :iduser'); $req->execute(array('iduser' => $_POST["iduser"])) or die(print_r('10' . $bdd->errorInfo(), true)); }
<?php session_start(); include 'Helper/Helper_Mail.php'; $texte = htmlspecialchars($_GET["contenuMail"]); if ($_GET["rep"] == 1 or $_GET["rep"] == 4) { //mail dejà envoyé header('Location:profile.php?rep=4'); } else { if ($texte != null) { // Envoi du mail $mail_demandeur = new Helper_Mail(); $mail_demandeur->to("*****@*****.**")->sujet("Demande/Question")->content("" . $texte)->send(); header('Location:profile.php?rep=1'); } else { if ($texte == null) { header('Location:profile.php?rep=2'); } else { header('Location:profile.php?rep=3'); } } }
$req = $bdd->prepare('SELECT email,prenom,nom, commentaire FROM needhelp LEFT JOIN etudiant ON needhelp.numero_etudiant = etudiant.numero_etudiant WHERE needhelp.id = :idannonce'); $req->execute(array('idannonce' => $_POST["idannonce"])) or die(print_r('1' . $bdd->errorInfo(), true)); $demandeur = $req->fetch(); // Mail helper $req = $bdd->prepare('SELECT email,nom,prenom FROM etudiant WHERE etudiant.numero_etudiant = :idetu'); $req->execute(array('idetu' => $_SESSION["login"])) or die(print_r('2' . $bdd->errorInfo(), true)); $helper = $req->fetch(); $mail_demandeur = new Helper_Mail(); $mail_demandeur->to($demandeur["email"])->sujet("Proposition d'aide")->content("L'etudiant " . $helper["prenom"] . " " . $helper["nom"] . " a repondu a votre demande d'aide : " . $demandeur["commentaire"] . ", merci de confirmer dans votre espace"); $mail_helper = new Helper_Mail(); $mail_helper->to($helper["email"])->sujet("Proposition d'aide")->content("Vous avez repondu a l'annonce : " . $demandeur["commentaire"] . ", merci d'attendre la confirmation de l'étudiant."); if ($mail_demandeur->send() && $mail_helper->send()) { $req = $bdd->prepare('UPDATE needhelp SET etat = 1 WHERE id = :idannonce '); $req->execute(array('idannonce' => $_POST["idannonce"])) or die('3' . print_r($bdd->errorInfo(), true)); $req = $bdd->prepare('INSERT INTO aide(numero_etudiant, id_needhelp) VALUES (:idetu, :idannonce) '); $req->execute(array('idetu' => $_SESSION["login"], 'idannonce' => $_POST["idannonce"])) or die(print_r('4' . $bdd->errorInfo(), true)); } else { echo "not ok lol"; } }
$req = $bdd->prepare('SELECT email,nom,prenom, commentaire FROM needhelp LEFT JOIN etudiant ON needhelp.numero_etudiant = etudiant.numero_etudiant WHERE needhelp.id = :idannonce'); $req->execute(array('idannonce' => $_POST["idannonce"])) or die(print_r('1' . $bdd->errorInfo(), true)); $demandeur = $req->fetch(); // Mail helper $req = $bdd->prepare('SELECT email,nom,prenom FROM aide LEFT JOIN etudiant ON aide.numero_etudiant = etudiant.numero_etudiant WHERE aide.id_needhelp = :idannonce'); $req->execute(array('idannonce' => $_POST["idannonce"])) or die(print_r('2' . $bdd->errorInfo(), true)); $helper = $req->fetch(); // Suppression des annonces $req = $bdd->prepare('DELETE FROM aide WHERE id_needhelp = :idannonce '); $req->execute(array('idannonce' => $_POST["idannonce"])) or die(print_r('4' . $bdd->errorInfo(), true)); $req = $bdd->prepare('DELETE FROM needhelp WHERE id = :idannonce '); $req->execute(array('idannonce' => $_POST["idannonce"])) or die(print_r('3' . $bdd->errorInfo(), true)); // Envoi des mails $mail_demandeur = new Helper_Mail(); $mail_demandeur->to($demandeur["email"])->sujet("Acceptation d'aide")->content("Vous avez accepte l'aide de l'etudiant " . $helper["prenom"] . " " . $helper["nom"] . " pour l'annonce : " . $demandeur["commentaire"] . ". Merci de prendre contact avec cette personne à l'adresse suivante : " . $helper["email"])->send(); $mail_helper = new Helper_Mail(); $mail_helper->to($helper["email"])->sujet("Acceptation d'aide")->content("Votre aide a ete acceptée pour l'annonce : " . $demandeur["commentaire"] . " de " . $demandeur["prenom"] . " " . $demandeur["nom"] . " . Merci de prendre contact à l'adresse suivante : " . $demandeur["email"])->send(); } else { }