User: Hp Date: 06/06/2015 Time: 14:33
Example #1
0
function lauchScript1()
{
    $managers = new Managers('pdo', PDOFactory::getMysqlConnexion());
    $reservationManager = $managers->getManagerOf('announcementreservations');
    $announcementManager = $managers->getManagerOf('announcements');
    $userManager = $managers->getManagerOf('users');
    //On supprime les réservations non-payée
    $reservationManager->deletePassedWaitingPaiement();
    $listOfReservationPassed = $reservationManager->getListOfPassed();
    $messageMail = new Mail();
    $countRervation = 0;
    foreach ($listOfReservationPassed as $reservation) {
        $reservation->setStateId(PaiementStates::CANCELED);
        $reservation->setUpdatedTime(time());
        $reservation->setKeyCheck(null);
        $reservationManager->save($reservation);
        $announce = $announcementManager->get($reservation->getAnnouncementId());
        $userOwner = $userManager->get($reservation->getUserOwnerId());
        $userSubscriber = $userManager->get($reservation->getUserSubscriberId());
        $messageMail->sendReservationSubscriberCanceled($userOwner, $userSubscriber, $announce);
        $messageMail->sendAdminReservationSubscriberCanceled($userOwner, $userSubscriber, $announce, $reservation);
        $countRervation++;
    }
    if ($countRervation > 0) {
        echo $countRervation . ' mail(s) d\'annulation de réservation envoyé(s) !';
    }
}
 /**
  * Método que envia os e-mails para os professores semanalmente
  */
 public function enviar_newsletter()
 {
     set_time_limit(600);
     if (!$this->configs->status) {
         //impedindo o envio antes da ativação
         die('O envio esta desativado');
     }
     if ($this->configs->diaEnvio != (int) date('N')) {
         //Impedindo o envio fora do dia correto
         die('Hoje não é dia de envio');
     }
     $professorObj = new Kernel_Models_Contratos();
     $constaEnvio = new Kernel_Models_NewsletterContas();
     $usuarioSistema = new Kernel_Models_Usuario();
     $todos = $professorObj->aceitaReceber(1, $this->configs->destinatariosEspecificos);
     $mail = new Mail();
     while ($professor = $todos->fetchObject()) {
         $emailDestino = $professor->email;
         if ($this->configs->efetuarTeste) {
             $emailDestino = $this->configs->emailTeste;
         }
         if (filter_var($emailDestino, FILTER_VALIDATE_EMAIL)) {
             $token = $usuarioSistema->gerarToken($professor->pk_usuario, Kernel_Models_TiposUsuario::TIPO_PROFESSOR);
             if ($token) {
                 echo "Enviando para {$professor->nome}({$emailDestino}){$professor->pk_usuario_professor}<br>)";
                 $mail->mensagemDeModelo(array('titulo' => 'Olá ' . $professor->nome, 'subtitulo' => 'Este é o seu resumo semanal', 'conteudo' => 'Clique <a href="' . base_url() . 'usuario/auth/verificar_acesso/' . $token . '?pagina=' . base_url() . 'agendas/professor/meu_resumo_semanal/' . '">aqui</a> para ver o resumo das suas atividades '));
                 if ($constaEnvio->enviar($professor->nome, $emailDestino, 'Agenda semanal do professor', $mail->getMensagem())) {
                     echo 'Email enviado com sucesso<br>';
                 } else {
                     echo 'Falha ao enviar o e-mail para ' . $professor->nome . '<br>' . $constaEnvio->getErros() . '<br>';
                 }
             }
         }
     }
 }
Example #3
0
 /**
  * Send notification to admin if need
  * @param $fromCheckPointTime
  * @return bool
  */
 private function _sendNotification($fromCheckPointTime)
 {
     if (!Yii::app()->params['csb']['notifyAdmin'] || empty(Yii::app()->params['csb']['adminEmail'])) {
         return;
     }
     // send log of blocked users for last period
     $lockedUsers = CsbLog::model()->findAll('create_time > :createTime AND type = :type', array(':createTime' => $fromCheckPointTime, ':type' => CsbLog::TYPE_LOCK));
     if (!$lockedUsers) {
         $this->_verbose("There's no new locked IPs");
         return false;
     }
     $notification = 'Some users were blocked. Check Time ' . date('Y-m-d H:i:s') . '<br /><br />
         <table cellpadding="5px" cellspacing="5px">
         <tr>
             <th>IP</th>
             <th>Block Time</th>
             <th>Block Till Time</th>
             <th>User</th>
             <th>Details</th>
         </tr>';
     foreach ($lockedUsers as $row) {
         $notification .= '<tr>
             <td>' . long2ip($row->ip) . '</td>
             <td>' . $row->create_time . '</td>
             <td>' . $row->till_time . '</td>
             <td>' . $row->user_id . '</td>
             <td>' . $row->details . '</td>
         </tr>';
     }
     $notification .= '</table>';
     $mail = new Mail();
     $mail->setSubject('Some users were blocked')->setBodyHtml($notification)->addTo(Yii::app()->params['csb']['adminEmail'])->send();
     $this->_verbose("Email was sent to admin", null, self::VERBOSE_INFO);
 }
 public function send()
 {
     if (isset($this->request->post['email']) && $this->request->post['email'] && isset($this->request->post['comments']) && $this->request->post['comments']) {
         $this->load->language('common/maintenance');
         $data['maintenance_type'] = $type = $this->config->get('config_maintenance_type') ? 'building' : 'maintenance';
         $data['maintenance_title'] = $this->language->get('heading_title_' . $type);
         $html = 'E-mail: <b>' . $this->request->post['email'] . '</b><br />' . 'Comentário: <b>' . $this->request->post['comments'] . '</b>';
         if (!preg_match('/^[^\\@]+@.*.[a-z]{2,15}$/i', $this->request->post['email'])) {
             exit('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i>&nbsp;E-mail Inválido!</div>');
         }
         $mail = new Mail($this->config->get('config_mail'));
         $mail->setTo($this->config->get('config_email'));
         $mail->setFrom($this->request->post['email']);
         $mail->setSender($this->request->post['email']);
         $mail->setSubject($data['maintenance_title'] . ' - ' . $this->config->get('config_name'));
         $mail->setHtml($html);
         $mail->setText(html_entity_decode(strip_tags($html), ENT_QUOTES, 'UTF-8'));
         if ($mail->send()) {
             exit('<div class="alert alert-success"><i class="fa fa-check-circle"></i>&nbsp;Informações enviadas com sucesso!</div>');
         } else {
             exit('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i>&nbsp;Erro ao enviar!</div>');
         }
     } else {
         exit('<div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i>&nbsp;E-mail ou comentário não informado!</div>');
     }
 }
Example #5
0
 /**
  * Create new request and sends email to user
  * @static
  * @param string Mail adress
  * @throws MailFailureException, UserNotFoundException
  */
 public static function createRequest($mail)
 {
     LostPW::cleanUp();
     $user = User::find('email', $mail);
     if ($user == NULL) {
         throw new UserNotFoundException();
     }
     // Delete old requests
     $sql = System::getDatabase()->prepare('DELETE FROM lostpw WHERE user_ID = :uid');
     $sql->execute(array(':uid' => $user->uid));
     // Create new request
     $hash = LostPW::createHash();
     $sql = System::getDatabase()->prepare('INSERT INTO lostpw (user_ID, hash, time) VALUES (:uid, :hash, :time)');
     $sql->execute(array(':uid' => $user->uid, ':hash' => $hash, ':time' => time()));
     // Send Mail
     $content = new Template();
     $content->assign('link', Router::getInstance()->build('AuthController', 'lostpw_check', array('hash' => $hash)));
     $content->assign('user', $user);
     $content->assign('title', System::getLanguage()->_('LostPW'));
     // Determine template file
     $tpl = 'mails/lostpw.' . LANGUAGE . '.tpl';
     foreach ($content->getTemplateDir() as $dir) {
         $file = 'mails/lostpw.' . $user->lang . '.tpl';
         if (file_exists($dir . $file)) {
             $tpl = $file;
             break;
         }
     }
     $mail = new Mail(System::getLanguage()->_('LostPW'), $content->fetch($tpl), $user);
     $mail->send();
 }
Example #6
0
 public function actionWrite()
 {
     if (isset($_GET["reply"])) {
         $reply = Mail::model()->with("buddy")->findByPk((int) $_GET["reply"], "t.user_id = :user_id", array(":user_id" => Yii::app()->user->id));
         $reply->setSeen();
     } else {
         $reply = null;
     }
     $message = new Mail();
     if ($reply) {
         $message->sendTo = $reply->buddy->login;
         if (preg_match('/^Re: (.*)$/', $reply->subj, $res)) {
             $subj = "Re[1]: {$res[1]}";
         } elseif (preg_match('/^Re\\[(\\d+)\\]: (.*)$/', $reply->subj, $res)) {
             $subj = "Re[" . ($res[1] + 1) . "]: " . $res[2];
         } else {
             $subj = "Re: {$reply->subj}";
         }
         $message->subj = $subj;
     } elseif (isset($_GET["to"])) {
         $message->sendTo = trim(strip_tags($_GET["to"]));
     }
     if (isset($_POST["Mail"])) {
         $message->setAttributes($_POST["Mail"]);
         if ($message->send()) {
             Yii::app()->user->setFlash("success", "Письмо отправлено " . $message->buddy->ahref);
             $this->redirect("/my/mail");
         }
     }
     if (!$reply) {
         $buddies = User::model()->findAll(array("select" => array("t.id", "t.login", "t.sex", "t.upic"), "join" => "RIGHT JOIN mail ON t.id = mail.buddy_id", "condition" => "mail.user_id = :user_id", "group" => "t.id", "order" => "COUNT(*) DESC", "limit" => 20, "params" => array(":user_id" => Yii::app()->user->id)));
         $this->side_view = array("write_side" => array("message" => $message, "buddies" => $buddies));
     }
     $this->render("write", array("message" => $message, "reply" => $reply));
 }
Example #7
0
 /**
  * Hook comment publishing
  *
  * @param object $Comment
  * @param object $Post
  * @param object $Parent
  * @param object $ParentAuthor
  */
 public function hookCommentPublished($Comment, $Post, $Parent = NULL, $ParentAuthor = NULL)
 {
     // If you post comment to your post
     if ($Post->aid != $Comment->aid) {
         $replace = array('$user_link%' => $this->user->getLink(), '%user_name%' => $this->user->getName(), '%post_link%' => $Post->getLink(), '%post_name%' => $Post->name, '%comment%' => $Comment->body, '%reply_link%' => $Post->getLink() . '#comment-' . $Comment->id);
         $mail = new Mail(array('name' => 'comment.post', 'subject' => t('New comment to your post', 'Mail.templates'), 'body' => str_replace(array_keys($replace), array_values($replace), t('User <a href="%user_link%">%user_name%</a> has published a comment to your post <a href="%post_link%">"%post_name%"</a>:
                         <p><i>%comment%</i></p>
                         <p><a href="%reply_link%">Reply &rarr;</a></p>'))));
         if ($PostAuthor = user($Post->aid)) {
             $mail->to($PostAuthor->email);
             $mail->send();
         }
     }
     /**
      * If you reply and not to yourself
      */
     if ($Parent && $Parent->aid != $this->user->id) {
         $replace = array('$user_link%' => $this->user->getLink(), '%user_name%' => $this->user->getName(), '%post_link%' => $Post->getLink(), '%post_name%' => $Post->name, '%comment%' => $Comment->body, '%reply_link%' => $Post->getLink() . '#comment-' . $Comment->id);
         $mail = new Mail(array('name' => 'comment.reply', 'subject' => t('Reply for your comment', 'Mail.templates'), 'body' => str_replace(array_keys($replace), array_values($replace), t('User <a href="%user_link%">%user_name%</a> has answered for you comment to post <a href="%post_link%">"%post_name%"</a>:
                         <p><i>%comment%</i></p>
                         <p><a href="%reply_link%">Reply &rarr;</a></p>', 'Mail.templates'))));
         $mail->to($ParentAuthor->email);
         $mail->send();
     }
     unset($mail);
 }
Example #8
0
 /**
  * @covers Xoops\Form\Mail::render
  */
 public function testRender()
 {
     $value = $this->object->render();
     $this->assertTrue(is_string($value));
     $this->assertTrue(false !== strpos($value, '<input'));
     $this->assertTrue(false !== strpos($value, 'type="email"'));
 }
Example #9
0
 public function postSaveadd()
 {
     $cre = ['name' => Input::get('name'), 'email' => Input::get('email'), 'enquiry' => Input::get('enquiry'), 'message' => Input::get('message')];
     $rules = ['name' => 'required', 'email' => 'required|email', 'enquiry' => 'required|not_in:0', 'message' => 'required'];
     $validator = Validator::make($cre, $rules);
     if ($validator->passes()) {
         require app_path() . '/mail.php';
         require app_path() . '/libraries/PHPMailerAutoload.php';
         $mail = new PHPMailer();
         $mail_text = new Mail();
         $mail->isMail();
         $mail->setFrom('*****@*****.**', 'Corper Life');
         $mail->addAddress('*****@*****.**');
         $mail->addAddress('*****@*****.**');
         $mail->isHTML(true);
         $mail->Subject = "Advertisement Request | Corper Life";
         $mail->Body = $mail_text->advert(Input::get("name"), Input::get("email"), Input::get("enquiry"), Input::get("phone"), Input::get("message"));
         if (!$mail->send()) {
             return Redirect::Back()->with('failure', 'Mailer Error: ' . $mail->ErrorInfo);
         } else {
             return Redirect::Back()->with('success', 'Your enquiry has been submitted. We will respond to it asap.');
         }
     } else {
         return Redirect::Back()->withErrors($validator)->withInput();
     }
 }
Example #10
0
function notifyNewUser($address, $username, $logname, $logpwd)
{
    global $AppUI, $dPconfig;
    $mail = new Mail();
    if ($mail->ValidEmail($address)) {
        if ($mail->ValidEmail($AppUI->user_email)) {
            $email = $AppUI->user_email;
        } else {
            $email = 'dotproject@' . $AppUI->cfg['site_domain'];
        }
        $name = $AppUI->user_first_name . ' ' . $AppUI->user_last_name;
        $body = $username . ',
		
An access account has been created for you in our dotProject project management system.

You can access it here at ' . $dPconfig['base_url'] . '

Your username is: ' . $logname . '
Your password is: ' . $logpwd . '

This account will allow you to see and interact with projects. If you have any questions please contact us.';
        $mail->From('"' . $name . '" <' . $email . '>');
        $mail->To($address);
        $mail->Subject('New Account Created - dotProject Project Management System');
        $mail->Body($body);
        $mail->Send();
    }
}
 public function actionIndex()
 {
     if (Yii::app()->user->isGuest or Yii::app()->user->access_level < Config::get('access_level_admin')) {
         $this->redirect(Yii::app()->homeUrl);
     }
     $this->pageTitle = Yii::t('title', 'Send mail');
     $model = new Mail();
     if (isset($_POST['Mail'])) {
         $model->attributes = $_POST['Mail'];
         $player_id = Players::model()->find('name = "' . $model->player_name . '"');
         if ($player_id->online == 1) {
             Yii::app()->user->setFlash('message', '<div class="flash_error">' . Yii::t('webshop', 'Error - You must first log out of the game server.') . '</div>');
         }
         $criteria = new CDbCriteria();
         $criteria->select = 'MAX(mail_unique_id) as mail_unique_id';
         $last_mail_id = Mail::model()->find($criteria);
         $model->mail_unique_id = $last_mail_id->mail_unique_id + 1;
         $model->mail_recipient_id = $player_id->id;
         $model->sender_name = 'ServerWebsite';
         $model->mail_title = $model->mail_title;
         $model->mail_message = $model->mail_message . "\n\nThis has been sent via our server website.  Please, do not reply.";
         $model->unread = 1;
         // Fallenfate - Add function to send kinah to players.
         if ($model->item_count != NULL || $model->item_count != "") {
             $model->attached_item_id = 0;
             $model->attached_kinah_count = $model->item_count;
         }
         $model->express = 1;
         if ($model->save(false)) {
             Yii::app()->user->setFlash('message', '<div class="flash_success">' . Yii::t('main', 'Mail sent!') . '</div>');
             $this->refresh();
         }
     }
     $this->render('/admin/mail', array('model' => $model));
 }
Example #12
0
 function test_send_from_properties()
 {
     $msg = new Mail();
     $mail_to = 'to_one@test.fr; to_two@test.fr';
     $mail_from = 'from_one@test.fr; from_two@test.fr';
     $mail_objet = 'objet';
     $mail_contents = 'contents';
     $ret = $msg->send_from_properties($mail_to, $mail_objet, $mail_contents, $mail_from);
     if (ereg("127.0.0.1", $_SERVER['SERVER_ADDR'])) {
         self::assertFalse($ret);
     } else {
         self::assertTrue($ret);
     }
     $ret = $msg->send_from_properties($mail_to, $mail_objet, $mail_contents, $mail_from);
     if (ereg("127.0.0.1", $_SERVER['SERVER_ADDR'])) {
         self::assertFalse($ret);
     } else {
         self::assertTrue($ret);
     }
     $mail_sender = 'visiteur';
     $ret = $msg->send_from_properties($mail_to, $mail_objet, $mail_contents, $mail_from, $mail_sender);
     if (ereg("127.0.0.1", $_SERVER['SERVER_ADDR'])) {
         self::assertFalse($ret);
     } else {
         self::assertTrue($ret);
     }
     $mail_from = 'from_bidon';
     $mail_sender = 'visiteur';
     $ret = $msg->send_from_properties($mail_to, $mail_objet, $mail_contents, $mail_from, $mail_sender);
     self::assertFalse($ret);
 }
Example #13
0
 /**
  * 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();
 }
 function inscription()
 {
     $erreur_array = array('name' => -1, 'description' => -1, 'contenu' => -1, 'from' => -1, 'to' => -1);
     $erreur = false;
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {
         $array_user = $this->postLogin($erreur, $erreur_array);
         $nb = $this->userExist(array('email' => $array_user['user']['email']));
         if (!$erreur && !$nb) {
             $array_user['user']['is_verified'] = uniqid();
             $userDao = new UserDao(new User($array_user['user']));
             $userDao->create();
             //die(var_dump($array_services));
             $iduser = $userDao->getLastID();
             $array_user['adresse']['id_user'] = $iduser;
             $adresseDao = new AdresseDao(new Adresse($array_user['adresse']));
             $adresseDao->create();
             $mail = new Mail();
             $result = $mail->sendMailActivation('*****@*****.**', $array_user['user']['email'], $array_user['user']['prenom'], $array_user['user']['is_verified']);
             if ($result['send']) {
                 $this->set(array('success' => '1'));
                 $this->render('inscription');
             }
         } elseif ($nb) {
             $this->set(array('success' => '2'));
             $this->render('inscription');
         } elseif ($erreur) {
             $this->render('inscription');
         }
     }
     $this->set(array('success' => '0'));
     $this->render('inscription');
 }
 /**
  * User register
  * @global type $cart
  * @param type $registerInfo
  * @return boolean
  * @author hujs
  */
 public function register($registerInfo)
 {
     $this->load->model('account/customer');
     $this->model_account_customer->addCustomer($registerInfo);
     $this->language->load('mail/account_create');
     $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
     $message = sprintf($this->language->get('text_welcome'), $this->config->get('config_name')) . "\n\n";
     if (!$this->config->get('config_customer_approval')) {
         $message .= $this->config->get('text_login') . "\n";
     } else {
         $message .= $this->config->get('text_approval') . "\n";
     }
     $message .= HTTPS_SERVER . 'index.php?route=account/login' . "\n\n";
     $message .= $this->language->get('text_services') . "\n\n";
     $message .= $this->language->get('text_thanks') . "\n";
     $message .= $this->language->get('config_name');
     $mail = new Mail();
     $mail->protocol = $this->config->get('config_mail_protocol');
     $mail->parameter = $this->config->get('config_mail_parameter');
     $mail->hostname = $this->config->get('config_smtp_host');
     $mail->username = $this->config->get('config_smtp_username');
     $mail->password = $this->config->get('config_smtp_password');
     $mail->port = $this->config->get('config_smtp_port');
     $mail->timeout = $this->config->get('config_smtp_timeout');
     $mail->setTo($registerInfo['email']);
     $mail->setFrom($this->config->get('config_email'));
     $mail->setSender($this->config->get('config_name'));
     $mail->setSubject($subject);
     $mail->setText(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
     $mail->send();
     return true;
 }
Example #16
0
 function sendMail($params)
 {
     // Cargar todas las constantes definidas
     $constants = get_defined_constants();
     // Obtener la direccion a la cual se va a enviar (TO)
     $to = $params['to'];
     // Obtener la direccion a la cual se va a enviar (CC)
     $cc = $params['cc'];
     // Obtener la direccion a la cual se va a enviar (BCC)
     $bcc = $params['bcc'];
     // Obtener el subject del mail
     $subject = $params['subject'];
     // Obtener el path del template
     $template = $constants[strtoupper($params['TEMPLATE'])];
     // Cargar parametros del mail
     $mail = new Mail();
     $mail->from = MAIL_FROM;
     $mail->to = $to;
     $mail->cc = $cc;
     $mail->bcc = $bcc;
     $mail->subject = $subject;
     $mail->body = MailHelper::_getBody($template, $params);
     // Si el cuerpo excede cierta cantidad de caracteres, se codifica
     // en base64
     $mail->base64 = strlen($mail->body) > CANT_CARACTERES_EMAIL;
     // Enviar mail
     return $mail->send();
 }
Example #17
0
 public function make($message = false, $alt = false)
 {
     $instance = new Mail($this->config);
     if ($message) {
         $instance->message($message, $alt);
     }
     return $instance;
 }
Example #18
0
function setErrors($errorName)
{
    $mail = new Mail();
    $mail->to = 'iproger@icloud.com,toxaphp@gmail.com';
    $mail->subject = 'SCRIPT ERROR!!!!';
    $mail->content = 'Error in the script: <b>pay_subscription_order.php</b><br><br>Error: <b>' . $errorName . '</b>';
    $mail->send();
}
Example #19
0
 /**
  * Send an email notification to the site admin
  * @param string $subject The subject of the alert email
  * @param string $body The body of the message for the alert email
  * @return void sends an alert email to site admin
  */
 static function Alert($subject, $body)
 {
     App::LoadClass('Mail');
     $mail = new Mail();
     $mail->subject = $subject;
     $mail->body = $body;
     $mail->Send(Settings::Get('admin_email'));
 }
Example #20
0
function sendContactEmail($name, $message, $email = "", $phone = "")
{
    $to = '*****@*****.**';
    $subject = 'Teds Contact Form';
    $body = "From Name: " . $name . "\n\n" . "From Email: " . $email . "\n\n" . "Message: " . $message;
    $mail = new Mail($subject, $to, $body);
    return $mail->send();
}
 public function sendContactEmail($name, $message, $email = "", $phone = "")
 {
     $to = 'tmaski45@gmail.com, zach.fowler91@gmail.com, sfbf6667@yahoo.com';
     $subject = 'Waterfowlers Contact Form';
     $body = "From Name: " . $name . "\n\n" . "From Email: " . $email . "\n\n" . "Phone Number: " . $phone . "\n\n" . "Message: " . $message;
     $mail = new Mail($subject, $to, $body);
     return $mail->send();
 }
 private function convert_content()
 {
     if ($this->mail_to_send->is_html()) {
         $this->mailer->MsgHTML($this->mail_to_send->get_content());
     } else {
         $this->mailer->Body = $this->mail_to_send->get_content();
     }
 }
Example #23
0
 public function send(Mail $mail)
 {
     $this->conn->connect();
     $this->conn->mailFrom($mail->getBounceAddress());
     $this->conn->rcptTo($mail->getRecipient()->getEMail());
     $this->conn->data($mail->getRaw());
     $this->conn->disconnect();
 }
Example #24
0
 /**
  * @param array $params Parameters for creating an account
  *                      username, password, email are required
  *                      language, first_name, last_name are optional
  * @return array
  */
 public function create($params)
 {
     $params = $this->filter_parameters($params, array('username', 'password', 'first_name', 'last_name', 'email', 'language'));
     $v = new \Valitron\Validator($params);
     $v->rules(['required' => [['username'], ['password'], ['email'], ['language']]]);
     $used_values = null;
     $return_errors = null;
     if ($v->validate()) {
         if ($this->get_user_id($params['username']) !== false) {
             $used_values[] = 'username';
         }
         if ($this->email_used($params['email'])) {
             $used_values[] = 'email';
         }
         if ($used_values === null) {
             $v->rule('email', 'email');
             if ($v->validate()) {
                 $v->rules(['lengthMax' => [['username', 20]]]);
                 if ($v->validate()) {
                     $params['password'] = create_hash($params['password']);
                     $sql = "INSERT INTO user (";
                     foreach ($params as $key => $value) {
                         $sql .= $key . ",";
                     }
                     $sql = substr($sql, 0, -1);
                     $sql .= ") VALUES (";
                     foreach ($params as $key => $value) {
                         $sql .= " :" . $key . ",";
                         $params[':' . $key] = $value;
                     }
                     $sql = substr($sql, 0, -1);
                     $sql .= ")";
                     $query = $this->db->prepare($sql);
                     $query->execute($params);
                     $user_id = $this->get_user_id($params['username']);
                     $auth = new Token($this->db);
                     require_once 'core/Mail.php';
                     $mail = new Mail();
                     $mail->addAddress($params['email'], $params['username']);
                     $mail->isHTML(true);
                     $mail->Subject = "Welcome to buckbrowser";
                     $mail->Body = str_replace(['%username%', '%bb-link%'], [$params['username'], 'http://buckbrowser.langstra.nl'], file_get_contents(TEMPLATE_PATH . 'mail/signup.html'));
                     $mail->send();
                     return array('token' => $auth->create_token($user_id));
                 } else {
                     $return_errors['incorrect_fields'] = 'username';
                 }
             } else {
                 $return_errors['incorrect_fields'] = 'email';
             }
         } else {
             $return_errors['already_exists'] = $used_values;
         }
     } else {
         $return_errors['empty_fields'] = array_keys($v->errors());
     }
     return $this->create_error($return_errors);
 }
 public function sample3()
 {
     $data = array('John', '*****@*****.**', 'Sydney, NSW', 'Australia', 12, 06, 1980, '02 123 45678', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.');
     $template_html = 'sample-3.txt';
     $mail = new Mail();
     $mail->setMailBody($data, $template_html, 'TEXT');
     $mail->sendMail('Test Sample 3 Text Plain Template Format');
     exit('Email Sample 3');
 }
 public function sendemailAction()
 {
     if ($this->request->isPost()) {
         $email = $this->request->getPost('email', 'email');
         $did = $this->request->getPost('did');
         if (isset($did)) {
             $time = time();
             $emailContent = "亲爱的" . $email . ": \r\n";
             $emailContent .= "欢迎您来到中合万邦费控系统! \r\n";
             $emailContent .= "请马上点击以下链接完成注册 \r\n";
             $emailContent .= "http://wap.zhwbchina.com/register/verifyemail/" . md5($time . "+" . $email) . "\r\n";
             $emailContent .= "(如果该链接无法点击,请将它完成复制并粘贴至浏览器的地址栏中访问)\r\n\r\n\r\n";
             $emailContent .= "这是一封系统自动发出的邮件,请不要直接回复。\r\n";
             $emailContent .= "如有疑问可发送邮件至tech@zhwbchina.com。\r\n\r\n";
             $emailContent .= "中合万邦\r\n";
             $emailContent .= "http://www.zhwbchina.com";
             $mail = new Mail();
             $result = $mail->smtp($email, '请验证您的邮箱(自:中合万邦——费控系统)', $emailContent);
             //$result = true;
             $this->view->setVar("email", $email);
             $results = VerifyEmail::Find("email = '" . $email . "'");
             foreach ($results as $result) {
                 if ($result->delete() == false) {
                     //存log
                     foreach ($result->getMessages() as $message) {
                     }
                 } else {
                     //存log
                 }
             }
             $verifyEmail = new VerifyEmail();
             $verifyEmail->email = $email;
             $verifyEmail->time = $time;
             $verifyEmail->verifyCode = md5($time . "+" . $email);
             $verifyEmail->active = 'Y';
             $verifyEmail->did = $did;
             if ($verifyEmail->save() == false) {
                 foreach ($user->getMessages() as $message) {
                     $this->flash->error((string) $message);
                 }
             } else {
                 if ($result) {
                     $arrRs = explode('@', $email);
                     $mailLink = 'http://mail.' . $arrRs[1];
                     $this->view->setVar("mailLink", $mailLink);
                     $this->flash->success('邮件已发送至您的邮箱,请查收!');
                 } else {
                     $this->flash->error('发送失败!');
                     $this->forward('register/index');
                 }
             }
         } else {
         }
     } else {
         $this->response->redirect("index/index");
     }
 }
Example #27
0
 /**
  * Convert the raw XML into an object
  *
  * @param \SimpleXMLElement $xml
  * @return Mail
  */
 public static function createFromXML(\SimpleXMLElement $xml)
 {
     $mail = new Mail();
     if (isset($xml->attributes()['type'])) {
         $mail->setType((string) $xml->attributes()['type']);
     }
     $mail->setValue((string) $xml);
     return $mail;
 }
Example #28
0
 /**
  * Return a mail object depending of the requested format
  * 
  * @param String $type Type of mail (text or html)
  * 
  * @return Mail
  */
 public function getMailByType($type = null)
 {
     $mail = new Codendi_Mail();
     if ($type == Codendi_Mail_Interface::FORMAT_TEXT) {
         $mail = new Mail();
     }
     $mail->setFrom($this->getConfig('sys_noreply'));
     return $mail;
 }
Example #29
0
 public static function sendAlarmMail($mail, $name, $unternehmenid, $text)
 {
     $m = new Mail();
     $m->setSubject('Alarm @ Middleware for Open Source Devices');
     $m->addAddress($mail, $name);
     $m->setMailContent($text);
     $m->send();
     self::insertEvent($unternehmenid, 'sent an email to your email account "' . $name . '"');
 }
 /**
  * @brief 쪽지 발송
  **/
 function procCommunicationSendMessage()
 {
     // 로그인 정보 체크
     if (!Context::get('is_logged')) {
         return new Object(-1, 'msg_not_logged');
     }
     $logged_info = Context::get('logged_info');
     // 변수 검사
     $receiver_srl = Context::get('receiver_srl');
     if (!$receiver_srl) {
         return new Object(-1, 'msg_not_exists_member');
     }
     $title = trim(Context::get('title'));
     if (!$title) {
         return new Object(-1, 'msg_title_is_null');
     }
     $content = trim(Context::get('content'));
     if (!$content) {
         return new Object(-1, 'msg_content_is_null');
     }
     $send_mail = Context::get('send_mail');
     if ($send_mail != 'Y') {
         $send_mail = 'N';
     }
     // 받을 회원이 있는지에 대한 검사
     $oMemberModel =& getModel('member');
     $oCommunicationModel =& getModel('communication');
     $receiver_member_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
     if ($receiver_member_info->member_srl != $receiver_srl) {
         return new Object(-1, 'msg_not_exists_member');
     }
     // 받을 회원의 쪽지 수신여부 검사 (최고관리자이면 패스)
     if ($logged_info->is_admin != 'Y') {
         if ($receiver_member_info->allow_message == 'F') {
             if (!$oCommunicationModel->isFriend($receiver_member_info->member_srl)) {
                 return new object(-1, 'msg_allow_message_to_friend');
             }
         } elseif ($receiver_member_info->allow_messge == 'N') {
             return new object(-1, 'msg_disallow_message');
         }
     }
     // 쪽지 발송
     $output = $this->sendMessage($logged_info->member_srl, $receiver_srl, $title, $content);
     // 메일로도 발송
     if ($output->toBool() && $send_mail == 'Y') {
         $view_url = Context::getRequestUri();
         $content = sprintf("%s<br /><br />From : <a href=\"%s\" target=\"_blank\">%s</a>", $content, $view_url, $view_url);
         $oMail = new Mail();
         $oMail->setTitle($title);
         $oMail->setContent($content);
         $oMail->setSender($logged_info->user_name, $logged_info->email_address);
         $oMail->setReceiptor($receiver_member_info->user_name, $receiver_member_info->email_address);
         $oMail->send();
     }
     return $output;
 }