public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $loginCompte = $request->request->get("Mot_De_Passe_Oublie_Compte");
     $emailCompte = $request->request->get("Mot_De_Passe_Oublie_Email");
     $passwordNew = \FonctionsUtiles::GenerateString(8);
     $objLogsOublieMotDePasse = new \Site\Entity\LogsOublieMotDePasse();
     $objLogsOublieMotDePasse->setCompteEssaye($loginCompte);
     $objLogsOublieMotDePasse->setEmailEssaye($emailCompte);
     $objLogsOublieMotDePasse->setIp($this->ipAdresse);
     $objLogsOublieMotDePasse->setDateEssai(new \DateTime(date("Y-m-d H:i:s")));
     $objAccount = \Account\AccountHelper::getAccountRepository()->findAccountByEmailAndLogin($emailCompte, $loginCompte);
     if ($objAccount !== null) {
         \Account\AccountHelper::getAccountRepository()->updateAccountPassword($objAccount->getId(), $passwordNew);
         $template = $this->objTwig->loadTemplate("PasswordForgottenEmail.html5.twig");
         $result = $template->render(["newMDP" => $passwordNew]);
         $subject = 'VamosMT2 - Nouveau mot de passe';
         \EmailHelper::sendEmail($emailCompte, $subject, $result);
         $objLogsOublieMotDePasse->setResultatDemande("1");
         echo "1";
     } else {
         $objLogsOublieMotDePasse->setResultatDemande("2");
         echo "2";
     }
     $em->persist($objLogsOublieMotDePasse);
     $em->flush();
 }
 public function index_action($params = null)
 {
     $dados = '';
     if ($_POST) {
         #DATA DO ENVIO
         $_POST['data'] = date('Y-m-d H:i:s');
         // #PREPARA ENVIO AUTENTICADO
         // $email = new EmailHelper();
         // $email -> _host    = "smtp.gmail.com";
         // $email -> _usuario = "*****@*****.**";
         // $email -> _senha   = "";
         // $email -> _nome    = $_POST['nome'];
         // $email -> _from    = $_POST['email'];
         // $email -> _to 	  = "*****@*****.**";
         // $email -> _assunto = $_POST['assunto'];
         #PREPARA ENVIO COMUM
         $email = new EmailHelper();
         $email->_nome = $_POST['nome'];
         $email->_from = $_POST['email'];
         $email->_to = "*****@*****.**";
         $email->_assunto = $_POST['assunto'];
         #FAZ O ENVIO
         if ($email->enviar($_POST['mensagem'])) {
             $dados['status'] = "<i class='icon-ok-sign'></i> Mensagem enviada com sucesso!";
             $dados['alert'] = 'alert-success';
             #INSERE CONTATO NO BANCO DE DADOS
             $db = new Contato_Model();
             $db->insert($_POST);
         } else {
             $dados['status'] = "<i class='icon-ban-circle'></i> Ocorreu um erro ao enviar a mensagem!";
             $dados['alert'] = 'alert-error';
         }
     }
     $this->view('index', $dados);
 }
Beispiel #3
0
 function EmailExample2()
 {
     parent::WebPage('EmailHelper Example 2');
     //Basic Example
     $emailHelper1 = new EmailHelper('*****@*****.**', '*****@*****.**', 'EmailHelper Basic', 'Some Test Message');
     //Message
     $emailHelper1->Send();
     //Advanced Example
     $emailHelper2 = new EmailHelper(array('*****@*****.**', '*****@*****.**'), array('*****@*****.**', '*****@*****.**', '*****@*****.**'), 'EmailHelper Advanced', array('Some Message', '<b>Some Message</b>'));
     //RichMessage
     //From
     $emailHelper2->Send();
 }
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $AccountLogin = $this->objAccount->getLogin();
     $AccountEmailOld = $this->objAccount->getEmail();
     $AccountId = $this->objAccount->getId();
     $AccountEmailNew = $request->request->get("emailapres");
     $IP = $request->server->get("REMOTE_ADDR");
     //Application de la modification
     $this->objAccount->setEmail($AccountEmailNew);
     $em->persist($this->objAccount);
     //Suppression de l'entrée de vérification
     \Site\SiteHelper::getControleChangementMailRepository()->deleteByAccountId($AccountId);
     //On insère dans les logs
     $objLogsChangementMail = new \Site\Entity\LogsChangementMail();
     $objLogsChangementMail->setIdCompte($AccountId);
     $objLogsChangementMail->setOld($AccountEmailOld);
     $objLogsChangementMail->setNew($AccountEmailNew);
     $objLogsChangementMail->setIp($IP);
     $objLogsChangementMail->setDate(new \DateTime(date("Y-m-d H:i:s")));
     $em->persist($objLogsChangementMail);
     $em->flush();
     //Envoi sur l'ancienne adresse
     $templateOld = $this->objTwig->loadTemplate("EmailChangeEmailOld.html5.twig");
     $resultOld = $templateOld->render(["compte" => $AccountLogin]);
     $subject = 'VamosMt2 - Changement de mail de ' . $AccountLogin . '';
     \EmailHelper::sendEmail($AccountEmailOld, $subject, $resultOld);
     //Envoi sur la nouvelle adresse
     $templateNew = $this->objTwig->loadTemplate("EmailChangeEmailNew.html5.twig");
     $resultNew = $templateNew->render(["compte" => $AccountLogin, "new" => $AccountEmailNew, "old" => $AccountEmailOld]);
     $subject = 'VamosMt2 - Changement de mail de ' . $AccountLogin . '';
     \EmailHelper::sendEmail($AccountEmailNew, $subject, $resultNew);
     echo '1';
 }
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $idCompte = $this->objAccount->getId();
     $idPersonnage = $request->request->get("id_personnage");
     $objPlayer = \Player\PlayerHelper::getPlayerRepository()->find($idPersonnage);
     if ($objPlayer !== null) {
         //Suppression des autres demandes
         \Site\SiteHelper::getSuppressionPersonnageRepository()->deleteByPlayerId($idPersonnage);
         $objAccount = \Account\AccountHelper::getAccountRepository()->find($idCompte);
         if ($objAccount !== null) {
             $numeroVerif = \FonctionsUtiles::GenerateString(8, "INT");
             //Envoie de l'email de vérification
             $template = $this->objTwig->loadTemplate("PersonnageDeleteEmailVerify.html5.twig");
             $result = $template->render(["account" => $objAccount->getLogin(), "player" => $objPlayer->getName(), "key" => $numeroVerif]);
             $subject = 'VamosMt2 - Suppression du personnage ' . $objPlayer->getName() . '';
             \EmailHelper::sendEmail($objAccount->getEmail(), $subject, $result);
             //Insertion de la demande
             $objSuppressionPersonnage = new \Site\Entity\SuppressionPersonnage();
             $objSuppressionPersonnage->setIdCompte($idCompte);
             $objSuppressionPersonnage->setIdPersonnage($idPersonnage);
             $objSuppressionPersonnage->setEmail($objAccount->getEmail());
             $objSuppressionPersonnage->setNumeroVerif($numeroVerif);
             $objSuppressionPersonnage->setDate(new \DateTime(date("Y-m-d H:i:s")));
             $objSuppressionPersonnage->setIp($this->ipAdresse);
             $em->persist($objSuppressionPersonnage);
             $em->flush();
             $Tableau_Retour_Json = array('result' => true);
         } else {
             $Tableau_Retour_Json = array('result' => false, 'reasons' => "Le compte n'existe pas.");
         }
         echo json_encode($Tableau_Retour_Json);
     }
 }
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $numeroVerif = $request->request->get("code");
     $objControleChangementMotDePasse = \Site\SiteHelper::getControleChangementMotDePasseRepository()->findByIdCompteAndNumeroVerif($this->objAccount->getId(), $numeroVerif);
     if ($objControleChangementMotDePasse !== null) {
         //Application du mot de passe
         $this->objAccount->setPassword($objControleChangementMotDePasse->getNouveauMotDePasse());
         $em->persist($this->objAccount);
         //Suppression des demandes
         \Site\SiteHelper::getControleChangementMotDePasseRepository()->deleteByAccountId($objControleChangementMotDePasse->getIdCompte());
         //Ajout dans les logs
         $objLogsChangementPassword = new \Site\Entity\LogsChangementPassword();
         $objLogsChangementPassword->setIdCompte($this->objAccount->getId());
         $objLogsChangementPassword->setEmail($this->objAccount->getEmail());
         $objLogsChangementPassword->setDate(new \DateTime(date("Y-m-d H:i:s")));
         $objLogsChangementPassword->setIp($this->ipAdresse);
         $em->persist($objLogsChangementPassword);
         $em->flush();
         //Envoi de l'email
         $template = $this->objTwig->loadTemplate("PasswordChangeTermEmail.html5.twig");
         $result = $template->render(["account" => $this->objAccount->getLogin()]);
         $subject = 'VamosMT2 - Changement du mot de passe terminé';
         \EmailHelper::sendEmail($this->objAccount->getEmail(), $subject, $result);
         echo "1";
     } else {
         echo "2";
     }
 }
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $idCompte = $request->request->get("idCompte");
     $idDiscussion = $request->request->get("idDiscussion");
     $message = $request->request->get("message");
     $objSupportMessage = new \Site\Entity\SupportMessages();
     $objSupportMessage->setIdCompte($idCompte);
     $objSupportMessage->setIdDiscussion($idDiscussion);
     $objSupportMessage->setMessage($message);
     $objSupportMessage->setDate(new \DateTime(date("Y-m-d H:i:s")));
     $objSupportMessage->setEtat(\SupportEtatMessageHelper::NON_LU);
     $objSupportMessage->setDatechangementEtat(new \DateTime(date("Y-m-d H:i:s")));
     $objSupportMessage->setIp($this->ipAdresse);
     try {
         $objSupportDiscussion = \Site\SiteHelper::getSupportDiscussionsRepository()->find($idDiscussion);
         $objSupportDiscussion->setDateDernierMessage(new \DateTime(date("Y-m-d H:i:s")));
         $em->persist($objSupportDiscussion);
         $em->persist($objSupportMessage);
         $em->flush();
         if ($idCompte == $objSupportDiscussion->getIdAdmin()) {
             $objAccountJoueur = \Account\AccountHelper::getAccountRepository()->find($objSupportDiscussion->getIdCompte());
             if ($objAccountJoueur !== null) {
                 $template = $this->objTwig->loadTemplate("MessagerieMessageAdd.html5.twig");
                 $result = $template->render(["compte" => $objAccountJoueur->getLogin(), "objet" => \SupportObjetsHelper::getLibelle($objSupportDiscussion->getIdObjet())]);
                 $subject = 'VamosMT2 - Réponse à votre ticket';
                 \EmailHelper::sendEmail($objAccountJoueur->getEmail(), $subject, $result);
             }
         }
         echo json_encode(["id" => $objSupportMessage->getId(), "date" => \DateTimeHelper::dateTimeToFormatedString($objSupportMessage->getDate(), "H:i"), "message" => nl2br($objSupportMessage->getMessage())]);
     } catch (Exception $ex) {
     }
 }
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $passwordOld = $request->request->get("Ancien_Mot_De_Passe");
     $passwordNew = $request->request->get("Nouveau_Mot_De_Passe");
     $objAccount = \Account\AccountHelper::getAccountRepository()->findAccountByLoginAndPassword($this->objAccount->getLogin(), $passwordOld);
     if ($objAccount !== null) {
         //Suppression des autres demandes
         \Site\SiteHelper::getControleChangementMotDePasseRepository()->deleteByAccountId($objAccount->getId());
         $Nombre_Unique = \FonctionsUtiles::GenerateString(8, "INT");
         $objControleChangementMotDePasse = new \Site\Entity\ControleChangementMotDePasse();
         $objControleChangementMotDePasse->setIdCompte($objAccount->getId());
         $objControleChangementMotDePasse->setCompte($objAccount->getLogin());
         $objControleChangementMotDePasse->setNouveauMotDePasse($passwordNew);
         $objControleChangementMotDePasse->setNumeroVerif($Nombre_Unique);
         $objControleChangementMotDePasse->setIp($this->ipAdresse);
         $em->persist($objControleChangementMotDePasse);
         $em->flush();
         $template = $this->objTwig->loadTemplate("PasswordChangeEmail.html5.twig");
         $result = $template->render(["account" => $objAccount->getLogin(), "key" => $Nombre_Unique]);
         $subject = 'VamosMT2 - Changement de mot de passe';
         \EmailHelper::sendEmail($objAccount->getEmail(), $subject, $result);
         echo '1';
     } else {
         echo '2';
     }
 }
 /**
  * Override to avoid actually sending emails out through transport.
  * (non-PHPdoc)
  * @see EmailHelper::sendEmail()
  */
 protected function sendEmail(Mailer $mailer, EmailMessage $emailMessage)
 {
     if (!$this->sendEmailThroughTransport) {
         $emailMessage->error = null;
         $emailMessage->folder = EmailFolder::getByBoxAndType($emailMessage->folder->emailBox, EmailFolder::TYPE_SENT);
     } else {
         parent::sendEmail($mailer, $emailMessage);
     }
 }
Beispiel #10
0
 function EmailExample3()
 {
     parent::WebPage('EmailHelper Example 3');
     //Basic Example
     EmailHelper::Email('*****@*****.**', '*****@*****.**', 'EmailHelper Basic', 'Some Test Message');
     //Message
     //Advanced Example
     EmailHelper::Email(array('*****@*****.**', '*****@*****.**'), array('*****@*****.**', '*****@*****.**', '*****@*****.**'), 'EmailHelper Advanced', array('Some Message', '<b>Some Message</b>'));
     //RichMessage
 }
Beispiel #11
0
 public function postRequest()
 {
     $token = JSession::checkToken();
     if (!$token) {
         die('Invail request');
     }
     $app = jfactory::getApplication();
     AImporter::helper('email');
     AImporter::classes('order/custom');
     $order = new BookproCustomOrder();
     $order->orderinfo = $this->input->get('orderinfo', array(), 'array');
     $order->customer = $_POST;
     $db = JFactory::getDbo();
     if ($order->save()) {
         $mail = new EmailHelper($order->table->id);
         $mail->sendMail();
         $app->enqueueMessage(JText::_('COM_BOOKPRO_CUSTOM_THANKS_FOR_BOOKING'));
     }
     $app->redirect('index.php?option=com_bookpro&view=customservice');
     return;
 }
 /**
  * (non-PHPdoc)
  * @see IActionController::executeAction()
  */
 public function executeAction($parameters)
 {
     // read the post from PayPal system and add 'cmd'
     $req = 'cmd=_notify-validate';
     foreach ($_POST as $key => $value) {
         $value = urlencode(stripslashes($value));
         $req .= "&{$key}={$value}";
     }
     // post back to PayPal system to validate
     $header = "POST /cgi-bin/webscr HTTP/1.0\r\n";
     $header .= "Host: " . $this->_websoccer->getConfig("paypal_host") . "\r\n";
     $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
     $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
     $fp = fsockopen($this->_websoccer->getConfig("paypal_url"), 443, $errno, $errstr, 30);
     if (!$fp) {
         throw new Exception("Error on HTTP(S) request. Error: " . $errno . " " . $errstr);
     } else {
         fputs($fp, $header . $req);
         $response = "";
         while (!feof($fp)) {
             $res = fgets($fp, 1024);
             $response .= $res;
             if (strcmp($res, "VERIFIED") == 0) {
                 // PAYMENT VALIDATED & VERIFIED!
                 // check receiver e-mail
                 if (strtolower($parameters["receiver_email"]) != strtolower($this->_websoccer->getConfig("paypal_receiver_email"))) {
                     EmailHelper::sendSystemEmail($this->_websoccer, $this->_websoccer->getConfig("systememail"), "Failed PayPal confirmation: Invalid Receiver", "Invalid receiver: " . $parameters["receiver_email"]);
                     throw new Exception("Receiver E-Mail not correct.");
                 }
                 if ($parameters["payment_status"] != "Completed") {
                     EmailHelper::sendSystemEmail($this->_websoccer, $this->_websoccer->getConfig("systememail"), "Failed PayPal confirmation: Invalid Status", "A paypment notification has been sent, but has an invalid status: " . $parameters["payment_status"]);
                     throw new Exception("Payment status not correct.");
                 }
                 // credit amount to user
                 $amount = $parameters["mc_gross"];
                 $userId = $parameters["custom"];
                 PremiumDataService::createPaymentAndCreditPremium($this->_websoccer, $this->_db, $userId, $amount, "paypal-notify");
                 // we can exit script execution here, since action is called in background
                 die(200);
             } else {
                 if (strcmp($res, "INVALID") == 0) {
                     // PAYMENT INVALID & INVESTIGATE MANUALY!
                     throw new Exception("Payment is invalid");
                 }
             }
         }
         fclose($fp);
         header('X-Error-Message: invalid paypal response: ' . $response, true, 500);
         die('X-Error-Message: invalid paypal response: ' . $response);
     }
     return null;
 }
 public function run()
 {
     $objSafebox = \Player\PlayerHelper::getSafeboxRepository()->findByIdCompte($this->objAccount->getId());
     $template = $this->objTwig->loadTemplate("CodeEntrepotForgottenEmail.html5.twig");
     if ($objSafebox !== null) {
         $result = $template->render(["password" => $objSafebox->getPassword()]);
     } else {
         $result = $template->render(["password" => "000000"]);
     }
     $subject = 'VamosMt2 - Mot de passe entrepot';
     \EmailHelper::sendEmail($this->objAccount->getEmail(), $subject, $result);
     echo json_encode(["result" => true]);
 }
 public function run()
 {
     global $request;
     global $session;
     global $config;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $login = $request->request->get("Utilisateur");
     $password = $request->request->get("Mot_De_Passe");
     $email = $request->request->get("Email");
     $objIpToCountry = \Site\SiteHelper::getIpToCountryRepository()->findCountryBetween(ip2long($this->ipAdresse));
     if ($objIpToCountry !== null) {
         $Langue = $objIpToCountry->getCntry();
     } else {
         $Langue = "Inconnu";
     }
     $passwordEncrypted = \FonctionsUtiles::myPasswordToDoubleSha1($password);
     $objAccount = new \Account\Entity\Account();
     $objAccount->setLogin(trim($login));
     $objAccount->setPassword($passwordEncrypted);
     $objAccount->setEmail($email);
     $objAccount->setCash($config["register"]["initCash"]);
     $objAccount->setMileage($config["register"]["initMileage"]);
     $objAccount->setIpCreation($this->ipAdresse);
     $objAccount->setLangue($Langue);
     $objAccount->setCreateTime(new \DateTime(date("Y-m-d H:i:s")));
     $anneeRestantMysql = 2037 - date("Y");
     $dateActuel = \Carbon\Carbon::now();
     $dateBonusNew = $dateActuel->addYear($anneeRestantMysql);
     $objAccount->setMarriageFastExpire(new \DateTime(date("Y-m-d H:i:s")));
     $objAccount->setMoneyDropRateExpire(new \DateTime(date("Y-m-d H:i:s")));
     $objAccount->setGoldExpire(new \DateTime(date("Y-m-d H:i:s")));
     $objAccount->setSilverExpire(new \DateTime(date("Y-m-d H:i:s")));
     $objAccount->setAutolootExpire($dateBonusNew);
     $objAccount->setFishMindExpire(new \DateTime(date("Y-m-d H:i:s")));
     $objAccount->setSafeboxExpire($dateBonusNew);
     if ($config["register"]["emailActivation"]) {
         $objAccount->setStatus(\StatusHelper::NON_CONFIRME);
     } else {
         $objAccount->setStatus(\StatusHelper::ACTIF);
     }
     $em->persist($objAccount);
     $em->flush();
     if ($config["register"]["emailActivation"]) {
         $template = $this->objTwig->loadTemplate("InscriptionSubmitVerif.html5.twig");
         $result = $template->render(["account" => $objAccount->getLogin(), "accountId" => $objAccount->getId()]);
         $subject = 'VamosMT2 - Activez votre compte ' . $objAccount->getLogin();
         \EmailHelper::sendEmail($objAccount->getEmail(), $subject, $result);
     }
     $session->set("NomTemporaire", trim($login));
     echo "1";
 }
 /**
  * Send an email using the PHP mail() function
  *
  * Please note that 'encoded-words' should be used according to
  * RFC2047. Basically this means that the subject should be
  * encoded if necessary, as well as (real) names in 'From', 'To'
  * or 'Reply-To' header field bodies. For details see RFC2047.
  *
  * The parts of a message body should be encoded (quoted-printable
  * or base64) to make non-US-ASCII text work with the widest range
  * of email transports and clients.
  *
  * @throws EmailGatewayException
  * @throws EmailValidationException
  * @return bool
  */
 public function send()
 {
     $this->validate();
     try {
         // Encode recipient names (but not any numeric array indexes)
         $recipients = array();
         foreach ($this->_recipients as $name => $email) {
             // Support Bcc header
             if (isset($this->_header_fields['Bcc']) && $this->_header_fields['Bcc'] == $email) {
                 continue;
             }
             // if the key is not numeric, qEncode the key.
             $name = General::intval($name) > -1 ? General::intval($name) : EmailHelper::qEncode($name);
             $recipients[$name] = $email;
         }
         // Combine keys and values into a recipient list (name <email>, name <email>).
         $recipient_list = EmailHelper::arrayToList($recipients);
         // Encode the subject
         $subject = EmailHelper::qEncode((string) $this->_subject);
         // Build the 'From' header field body
         $from = empty($this->_sender_name) ? $this->_sender_email_address : EmailHelper::qEncode($this->_sender_name) . ' <' . $this->_sender_email_address . '>';
         // Build the 'Reply-To' header field body
         if (!empty($this->_reply_to_email_address)) {
             $reply_to = empty($this->_reply_to_name) ? $this->_reply_to_email_address : EmailHelper::qEncode($this->_reply_to_name) . ' <' . $this->_reply_to_email_address . '>';
         }
         if (!empty($reply_to)) {
             $this->_header_fields = array_merge($this->_header_fields, array('Reply-To' => $reply_to));
         }
         // Build the message from the attachments, the html-text and the plain-text.
         $this->prepareMessageBody();
         // Build the header fields
         $this->_header_fields = array_merge($this->_header_fields, array('Message-ID' => sprintf('<%s@%s>', md5(uniqid()), HTTP_HOST), 'Date' => date('r'), 'From' => $from, 'X-Mailer' => 'Symphony Email Module', 'MIME-Version' => '1.0'));
         // Format header fields
         $header_fields = array();
         foreach ($this->_header_fields as $name => $body) {
             $header_fields[] = sprintf('%s: %s', $name, $body);
         }
         /**
          * Make things nice for mail().
          * - Replace CRLF in the message body by LF as required by mail().
          * - Implode the header fields as required by mail().
          */
         $this->_body = str_replace("\r\n", "\n", $this->_body);
         $header_fields = implode("\r\n", $header_fields);
         // Send the email
         mail($recipient_list, $subject, $this->_body, $header_fields, "-f{$this->_sender_email_address}");
     } catch (Exception $e) {
         throw new EmailGatewayException($e->getMessage());
     }
     return true;
 }
Beispiel #16
0
 function EmailExample1()
 {
     parent::WebPage('EmailHelper Example 1');
     //Create EmailHelper
     $emailHelper1 = new EmailHelper();
     //From
     $emailHelper1->From = '*****@*****.**';
     //Reply-To - Not Required
     $emailHelper1->ReplyTo = '*****@*****.**';
     /*
      * All To, CC, and BCC can be set directly or via ArrayList
      * methods such as Add, AddRange, Insert, etc.
      * 
      * $emailHelper1->To = '*****@*****.**';
      * or
      * $emailHelper1->To = array('*****@*****.**', '*****@*****.**');
      * or
      * $emailHelper1->To->Add('*****@*****.**');
      * or
      * $emailHelper1->To->AddRange('*****@*****.**', '*****@*****.**');
      */
     //To
     $emailHelper1->To->Add('*****@*****.**');
     //CC - Not Required
     $emailHelper1->CC->Add('*****@*****.**');
     //BCC - Not Required
     $emailHelper1->BCC->Add('*****@*****.**');
     //Subject
     $emailHelper1->Subject = 'ExampleHelper Test';
     /*Message: Only one is required. If only RichMessage is set, then
     	 a Text version of Message will automatically be
     	 created for you.*/
     $emailHelper1->Message = 'Some Test Message';
     $emailHelper1->RichMessage = '<b>Some Test Message</b>';
     //Sending EmailHelper1
     $emailHelper1->Send();
 }
 /**
  * (non-PHPdoc)
  * @see IActionController::executeAction()
  */
 public function executeAction($parameters)
 {
     $user = $this->_websoccer->getUser();
     $columns = array();
     // save new password
     if ($parameters["newpassword"] != null) {
         // always create new salt (in order to invalid old cookies)
         $salt = SecurityUtil::generatePasswordSalt();
         $hashedPassword = SecurityUtil::hashPassword($parameters["newpassword"], $salt);
         $columns["passwort_salt"] = $salt;
         $columns["passwort"] = $hashedPassword;
     }
     // handle new e-mail
     if ($parameters["newemail"] != null) {
         $activationKey = SecurityUtil::generatePassword();
         $columns["schluessel"] = $activationKey;
         $columns["status"] = 2;
         $columns["email"] = $parameters["newemail"];
         $user->email = $parameters["newemail"];
         // send e-mail
         $querystr = "key=" . $columns["schluessel"] . "&userid=" . $user->id;
         $tplparameters["activationlink"] = $this->_websoccer->getInternalActionUrl("activate", $querystr, "activate-user", TRUE);
         // send e-mail
         EmailHelper::sendSystemEmailFromTemplate($this->_websoccer, $this->_i18n, $user->email, $this->_i18n->getMessage("activation_changedemail_subject"), "changed_email_activation", $tplparameters);
         $this->_websoccer->addFrontMessage(new FrontMessage(MESSAGE_TYPE_WARNING, $this->_i18n->getMessage("profile_changedemail_message_title"), $this->_i18n->getMessage("profile_changedemail_message_content")));
     }
     $columns["name"] = $parameters["realname"];
     $columns["wohnort"] = $parameters["place"];
     $columns["land"] = $parameters["country"];
     $columns["beruf"] = $parameters["occupation"];
     $columns["interessen"] = $parameters["interests"];
     $columns["lieblingsverein"] = $parameters["favorite_club"];
     $columns["homepage"] = $parameters["homepage"];
     $columns["c_hideinonlinelist"] = $parameters["c_hideinonlinelist"];
     if ($parameters["birthday"]) {
         $dateObj = DateTime::createFromFormat($this->_websoccer->getConfig("date_format"), $parameters["birthday"]);
         $columns["geburtstag"] = $dateObj->format("Y-m-d");
     }
     // update record
     if (count($columns)) {
         $fromTable = $this->_websoccer->getConfig("db_prefix") . "_user";
         $whereCondition = "id = %d";
         $this->_db->queryUpdate($columns, $fromTable, $whereCondition, $user->id);
     }
     // success message
     $this->_websoccer->addFrontMessage(new FrontMessage(MESSAGE_TYPE_SUCCESS, $this->_i18n->getMessage("saved_message_title"), ""));
     return "profile";
 }
Beispiel #18
0
 public function email($directory)
 {
     $game = $this->developer->games[$directory];
     $email = isset($_POST['email']) ? $_POST['email'] : '';
     $publication = isset($_POST['publication']) ? $_POST['publication'] : '';
     ViewHelper::render('email_presscopy', array('game' => $game, 'email' => $email, 'publication' => $publication));
     $body = ob_get_contents();
     ob_end_clean();
     $result = EmailHelper::send(EMAIL_SEND_TO, $_POST['email'], 'Request for Press Copy via presskit', $body);
     ob_start();
     if ($result === true) {
         echo 'OK';
     } else {
         echo $result;
     }
     ViewHelper::$template = 'ajax';
 }
Beispiel #19
0
 /**
  * Отправка тестового сообщения
  * @param obj $model
  * @return string
  */
 public static function sendTest($model)
 {
     $email = EmailHelper::getEmail($model);
     $mail = self::config('Test Message - ' . $email['subject'], $email['message']);
     $mail->AddAddress(Settings::getVal('test_email'), 'Test message');
     $mail->From = Settings::getVal('smtp_from_email');
     $mail->FromName = Settings::getVal('smtp_from_name');
     if (!$mail->Send()) {
         if ($mail->debug == 2) {
             return Yii::t('admin', $email['failed_message']) . '<br/>' . $mail->ErrorInfo;
         } else {
             return Yii::t('admin', $email['failed_message']);
         }
     } else {
         return Yii::t('admin', $email['success_message']);
     }
 }
 /**
  * Given a ZurmoConfigurationForm, save the configuration global values.
  */
 public static function setConfigurationFromForm(ZurmoConfigurationForm $form)
 {
     ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'applicationName', $form->applicationName);
     Yii::app()->timeZoneHelper->setGlobalValue((string) $form->timeZone);
     Yii::app()->pagination->setGlobalValueByType('listPageSize', (int) $form->listPageSize);
     Yii::app()->pagination->setGlobalValueByType('subListPageSize', (int) $form->subListPageSize);
     Yii::app()->pagination->setGlobalValueByType('modalListPageSize', (int) $form->modalListPageSize);
     Yii::app()->pagination->setGlobalValueByType('dashboardListPageSize', (int) $form->dashboardListPageSize);
     EmailHelper::setDefaultFromAddress($form->defaultFromEmailAddress);
     EmailHelper::setDefaultTestToAddress($form->defaultTestToEmailAddress);
     ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'gamificationModalNotificationsEnabled', (bool) $form->gamificationModalNotificationsEnabled);
     ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'gamificationModalCollectionsEnabled', (bool) $form->gamificationModalCollectionsEnabled);
     ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'gamificationModalCoinsEnabled', (bool) $form->gamificationModalCoinsEnabled);
     ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'realtimeUpdatesEnabled', (bool) $form->realtimeUpdatesEnabled);
     ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'reCaptchaPrivateKey', $form->reCaptchaPrivateKey);
     ZurmoConfigurationUtil::setByModuleName('ZurmoModule', 'reCaptchaPublicKey', $form->reCaptchaPublicKey);
 }
 public function actionIndex()
 {
     $messages = "";
     $error_type = "";
     $success = "";
     $name = "";
     $email = "";
     $description = "";
     $error = false;
     if (Yii::app()->getRequest()->ispostRequest) {
         $name = Yii::app()->request->getParam('name');
         $email = Yii::app()->request->getParam('email');
         $description = Yii::app()->request->getParam('description');
         if (empty($name)) {
             $error = true;
             $error_type = 'name';
             $messages = "Vui lòng nhập họ tên!";
         } elseif (!EmailHelper::isEmailAddress($email)) {
             $error = true;
             $error_type = 'email';
             $messages = "Email không hợp lệ!";
         } elseif (empty($description)) {
             $error = true;
             $error_type = 'description';
             $messages = "Vui lòng nhập thông tin liên hệ !";
         } else {
             $contact = new ContactModel();
             $contact->name = $name;
             $contact->content = $description;
             $contact->email = $email;
             $contact->project_des = !empty(Yii::app()->session['project_des']) ? Yii::app()->session['project_des'] : '';
             $contact->project_name = !empty(Yii::app()->session['project_name']) ? Yii::app()->session['project_name'] : '';
             $contact->project_pirce = !empty(Yii::app()->session['project_price']) ? Yii::app()->session['project_price'] : '';
             $contact->project_type = !empty(Yii::app()->session['project_type']) ? Yii::app()->session['project_type'] : '';
             $contact->project_time = !empty(Yii::app()->session['project_time']) ? Yii::app()->session['project_time'] : '';
             $contact->created_time = date('Y-m-d H:i:s');
             $contact->save();
             $success = true;
             $messages = "Quý khách đã gửi liên hệ thành công, chúng tôi sẽ liên hệ lại trong thời gian sớm nhất!";
         }
     }
     $this->render('index', compact('error', 'messages', 'error_type', 'name', 'email', 'description', 'success'));
 }
Beispiel #22
0
 public function actionSendMailQueue()
 {
     $criteria = new CDbCriteria(array('condition' => 'success=:success AND attempts < max_attempts', 'params' => array(':success' => 0)));
     $queueList = MailQueue::model()->findAll($criteria);
     foreach ($queueList as $queueItem) {
         $result = EmailHelper::sendEmail($queueItem->subject, $queueItem->to_email, $queueItem->message, $queueItem->from_email, $queueItem->from_name);
         if ($result) {
             $queueItem->attempts = $queueItem->attempts + 1;
             $queueItem->success = 1;
             $queueItem->last_attempt = time();
             $queueItem->date_sent = time();
             $queueItem->save(FALSE);
         } else {
             $queueItem->attempts = $queueItem->attempts + 1;
             $queueItem->last_attempt = time();
             $queueItem->save(FALSE);
         }
     }
 }
 public function ini()
 {
     $email1 = "*****@*****.**";
     $email1test = EmailHelper::validate($email1);
     $this->setVars("mail1", $email1test);
     $email2 = "renie.webdev@@gmail.com";
     $email2test = EmailHelper::validate($email2);
     $this->setVars("mail2", $email2test);
     $email3 = "*****@*****.**";
     $email3test = EmailHelper::validate($email3);
     $this->setVars("mail3", $email3test);
     $email4 = "*****@*****.**";
     $email4test = EmailHelper::validate($email4);
     $this->setVars("mail4", $email4test);
     $email5 = "renie.web*dev@gmail.com";
     $email5test = EmailHelper::validate($email5);
     $this->setVars("mail5", $email5test);
     $this->view('testEmail');
 }
Beispiel #24
0
 public static function forgotPassword(Db $db, $email, $pathtoTemplates = "templates/")
 {
     if (!self::emailExists($db, $email)) {
         return false;
     }
     $siteUrl = Constants::SITE_URL;
     $siteName = Constants::SITE_NAME;
     $newPass = UUID::generate();
     $newPassHash = md5($newPass);
     $pq = "update users set passhash = ? where email like ? limit 1";
     $db->preparedQuery($pq, array($newPassHash, $email), "ss");
     $plainMessage = "Your password has been reset to:\n\n{$newPass}\n\nPlease use this temporary password to log into the site and change it to a new, secure password of your choosing on the Edit Profile page.\n\nYou can follow this link:\n{$siteUrl}" . "admin/login.php?email={$email}&from=settings.php\n\nFrom: Automailer\n";
     $htmlMessage = EmailHelper::getEmailPara("Your password has been reset to:") . EmailHelper::getEmailPara("{$newPass}") . EmailHelper::getEmailPara("Please use this temporary password to log into the site and change it to a new, secure password of your choosing on the Edit Profile page.") . EmailHelper::getEmailPara("You can follow this link: <a style='color:#6666ff;' href='{$siteUrl}" . "admin/login.php?email={$email}&from=settings.php'>{$siteUrl}" . "login.php?email={$email}&from=settings.php</a>") . EmailHelper::getEmailPara("From: Automailer");
     $tHtml = new Template($pathtoTemplates . "mailers/holder.tpl.html");
     $tHtml->insertSlot("TITLE", "{$siteName} - Forgot Password");
     $tHtml->insertSlot("CONTENT", $htmlMessage);
     // do NOT error here, the password has been reset, dont return false so they think it has not
     @EmailHelper::sendHtmlEmail($tHtml->output(), $plainMessage, Constants::EMAIL_INFO, $email, "[{$siteName}] password reset");
     return true;
 }
Beispiel #25
0
 public function action_save()
 {
     if (count($_POST) > 0) {
         $errors = NULL;
         try {
             $user = Auth::instance()->get_user();
             $user = $user->update_user($_POST, array('password', 'email'));
             $user->save();
             EmailHelper::notify($user, $this->request->post('password'));
             $this->redirect_to_albums();
         } catch (ORM_Validation_Exception $e) {
             // todo: specify a real messages file here...
             // external errors are still in a sub-array, so we have to flatten
             // also the message is wrong  - bug #3896
             $errors = Arr::flatten($e->errors('hack'));
         }
         $this->show_profile_form($user, $errors);
     } else {
         $this->redirect_to_albums();
     }
 }
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $idAccount = $request->request->get("idAccount");
     if ($idAccount > 0) {
         $objAccount = \Account\AccountHelper::getAccountRepository()->find($idAccount);
         if ($objAccount !== null) {
             $objAccount->setStatus(\StatusHelper::ACTIF);
             $em->persist($objAccount);
             $objBannissementsActif = \Site\SiteHelper::getBannissementsActifsRepository()->findByIdAccount($objAccount->getId());
             if ($objBannissementsActif !== null) {
                 $objHistoriqueBannissement = new \Site\Entity\HistoriqueBanissements();
                 $oldReflection = new \ReflectionObject($objBannissementsActif);
                 $newReflection = new \ReflectionObject($objHistoriqueBannissement);
                 foreach ($oldReflection->getProperties() as $property) {
                     if ($newReflection->hasProperty($property->getName())) {
                         $newProperty = $newReflection->getProperty($property->getName());
                         $newProperty->setAccessible(true);
                         $newProperty->setValue($objHistoriqueBannissement, $property->getValue($objBannissementsActif));
                     }
                 }
                 $objHistoriqueBannissement->setDebannPar($this->objAccount->getId());
                 $em->persist($objHistoriqueBannissement);
                 $em->remove($objBannissementsActif);
             }
             $em->flush();
             $template = $this->objTwig->loadTemplate("Debannissement.html5.twig");
             $result = $template->render(["compte" => $objAccount->getLogin()]);
             $subject = 'VamosMt2 - Levé du bannissement de ' . $objAccount->getLogin() . '';
             \EmailHelper::sendEmail($objAccount->getEmail(), $subject, $result);
             $result = array('result' => true, 'reasons' => "");
         } else {
             $result = array('result' => false, 'reasons' => "Le compte sélectionné n'existe pas.");
         }
     } else {
         $result = array('result' => false, 'reasons' => "Problème de transmission d'identifiant.");
     }
     echo json_encode($result);
 }
 public function run()
 {
     $em = \Shared\DoctrineHelper::getEntityManager();
     $Nombre_Unique = \FonctionsUtiles::GenerateString(8, "INT");
     //Suppression des autres entrées de vérification
     \Site\SiteHelper::getControleChangementMailRepository()->deleteByAccountId($this->objAccount->getId());
     //Insertion de la clés de vérification
     $objControleChangementMail = new \Site\Entity\ControleChangementMail();
     $objControleChangementMail->setIdCompte($this->objAccount->getId());
     $objControleChangementMail->setEmail($this->objAccount->getEmail());
     $objControleChangementMail->setNumeroVerif($Nombre_Unique);
     $objControleChangementMail->setIp($this->ipAdresse);
     $objControleChangementMail->setDate(new \DateTime(date("Y-m-d H:i:s")));
     $em->persist($objControleChangementMail);
     $em->flush();
     //Envoi de l'email avec la clés
     $templateOld = $this->objTwig->loadTemplate("EmailChangeEmailVerify.html5.twig");
     $resultOld = $templateOld->render(["compte" => $this->objAccount->getLogin(), "key" => $Nombre_Unique]);
     $subject = 'VamosMt2 - Changement de mail de ' . $this->objAccount->getLogin() . '';
     \EmailHelper::sendEmail($this->objAccount->getEmail(), $subject, $resultOld);
     echo '1';
 }
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $idDiscussion = \Encryption::decrypt($request->request->get("idDiscussion"));
     $objSupportDiscussion = \Site\SiteHelper::getSupportDiscussionsRepository()->find($idDiscussion);
     $objAccount = \Account\AccountHelper::getAccountRepository()->find($objSupportDiscussion->getIdCompte());
     if ($objSupportDiscussion !== null) {
         if ($objSupportDiscussion->getIdCompte() == $this->objAccount->getId() or $objSupportDiscussion->getIdAdmin() == $this->objAccount->getId()) {
             $objSupportDiscussion->setEstArchive(1);
             $em->persist($objSupportDiscussion);
             $em->flush();
             $template = $this->objTwig->loadTemplate("MessagerieDiscussionCloture.html5.twig");
             $result = $template->render(["compte" => $objAccount->getLogin(), "objet" => \SupportObjetsHelper::getLibelle($objSupportDiscussion->getIdObjet())]);
             $subject = 'VamosMT2 - Clôture de votre ticket';
             \EmailHelper::sendEmail($objAccount->getEmail(), $subject, $result);
             echo json_encode(["result" => true]);
         } else {
             echo json_encode(["result" => false, "message" => "Le ticket est introuvable."]);
         }
     }
 }
 /**
  * (non-PHPdoc)
  * @see IActionController::executeAction()
  */
 public function executeAction($parameters)
 {
     $configKey = trim($this->_websoccer->getConfig("sofortcom_configkey"));
     if (!strlen($configKey)) {
         throw new Exception("Sofort.com configuration key is not configured.");
     }
     // verify user
     $userId = $parameters['u'];
     $result = $this->_db->querySelect("id", $this->_websoccer->getConfig("db_prefix") . "_user", "id = %d", $userId);
     $user = $result->fetch_array();
     $result->free();
     if (!$user) {
         throw new Exception("illegal user id");
     }
     // read the notification from php://input  (http://php.net/manual/en/wrappers.php.php)
     $SofortLib_Notification = new SofortLibNotification();
     $TestNotification = $SofortLib_Notification->getNotification(file_get_contents('php://input'));
     // read data
     $SofortLibTransactionData = new SofortLibTransactionData($configKey);
     $SofortLibTransactionData->addTransaction($TestNotification);
     // verify transaction data
     $SofortLibTransactionData->sendRequest();
     if ($SofortLibTransactionData->isError()) {
         EmailHelper::sendSystemEmail($this->_websoccer, $this->_websoccer->getConfig("systememail"), "Failed Sofort.com payment notification", "Error: " . $SofortLibTransactionData->getError());
         throw new Exception($SofortLibTransactionData->getError());
     } else {
         // verify status
         if ($SofortLibTransactionData->getStatus() != 'received') {
             EmailHelper::sendSystemEmail($this->_websoccer, $this->_websoccer->getConfig("systememail"), "Failed Sofort.com payment notification: invalid status", "Status: " . $SofortLibTransactionData->getStatus());
             throw new Exception("illegal status");
         }
         // credit amount
         $amount = $SofortLibTransactionData->getAmount();
         PremiumDataService::createPaymentAndCreditPremium($this->_websoccer, $this->_db, $userId, $amount, "sofortcom-notify");
     }
     return null;
 }
 /**
  * Send Test Message
  * @param SendGridWebApiConfigurationForm $configurationForm
  * @param string $fromNameToSendMessagesFrom
  * @param string $fromAddressToSendMessagesFrom
  */
 public static function sendTestMessage($configurationForm, $fromNameToSendMessagesFrom = null, $fromAddressToSendMessagesFrom = null)
 {
     if ($configurationForm->aTestToAddress != null) {
         $sendGridEmailAccount = new SendGridEmailAccount();
         $sendGridEmailAccount->apiUsername = $configurationForm->username;
         $sendGridEmailAccount->apiPassword = ZurmoPasswordSecurityUtil::encrypt($configurationForm->password);
         $isUser = false;
         if ($fromNameToSendMessagesFrom != null && $fromAddressToSendMessagesFrom != null) {
             $isUser = true;
             $from = array('name' => $fromNameToSendMessagesFrom, 'address' => $fromAddressToSendMessagesFrom);
         } else {
             $user = BaseControlUserConfigUtil::getUserToRunAs();
             $userToSendMessagesFrom = User::getById((int) $user->id);
             $from = array('name' => Yii::app()->emailHelper->resolveFromNameForSystemUser($userToSendMessagesFrom), 'address' => Yii::app()->emailHelper->resolveFromAddressByUser($userToSendMessagesFrom));
         }
         $emailMessage = EmailMessageHelper::processAndCreateTestEmailMessage($from, $configurationForm->aTestToAddress);
         $mailer = new ZurmoSendGridMailer($emailMessage, $sendGridEmailAccount);
         $emailMessage = $mailer->sendTestEmail($isUser);
         $messageContent = EmailHelper::prepareMessageContent($emailMessage);
     } else {
         $messageContent = Zurmo::t('EmailMessagesModule', 'A test email address must be entered before you can send a test email.') . "\n";
     }
     return $messageContent;
 }