Permet d'envoyer un mail via la fonction mail()

@access public
@param <void>
@return <bool> retour de mail()
2985
public function envoyer() {
        $this->setEntete();
        return mail($this->destinataire_email, $this->sujet, $this->message, $this->entete);
    }
1056685
function replyTo( $convert = true )
    {
//        return $this->Mail->getHeader( 'Reply-To' );
        if ( !$convert )
            return $this->ReplyTo;
        return $this->convertHeaderText( $this->ReplyTo );
    }
207056
public function postReminder() {
    $email = Input::get('email');

    try {
      $this->reminder->send($email);
      return Redirect::to("/user/recupero-success")->with(array ("messageReminder" => L::t('Check your mail inbox, we sent you an email to recover your password.')));
    } catch (Pbi $e) {
      $errors = $this->reminder->getErrors();
      return Redirect::back()->withErrors($errors);
    }
  }
42888
public function getTransport()
    {
        if (!self::$mailer) {

            self::$mailer = $this->getMailSystem()->getTransport();
            Events::dispatch('onMailTransport', array('transport' => self::$mailer));
        }
        return self::$mailer;
    }
1155894
public function send()
    {
        $oxEMail = oxNew(\OxidEsales\Eshop\Core\Email::class);
        $blSend = $oxEMail->sendNewsletterMail($this, $this->_oUser, $this->oxnewsletter__oxsubject->value);

        return $blSend;
    }
1359946
public function emailAction()
    {
        $model   = $this->getModel();

        $model->setFilter($this->getSearchFilter(false));

        $sort = array(
            'gr2o_email'          => SORT_ASC,
            'grs_first_name'     => SORT_ASC,
            'grs_surname_prefix' => SORT_ASC,
            'grs_last_name'      => SORT_ASC,
            'gto_valid_from'     => SORT_ASC,
            'gto_round_order'    => SORT_ASC,
            'gsu_survey_name'    => SORT_ASC,
        );

        if ($tokensData = $model->load(true, $sort)) {
            $params['mailTarget']           = 'token';
            $params['menu']                 = $this->menu;
            $params['model']                = $model;
            $params['identifier']           = $this->_getIdParam();
            $params['view']                 = $this->view;
            $params['routeAction']          = 'index';
            $params['formTitle']            = sprintf($this->_('Send mail to: %s'), $this->getTopic());
            $params['templateOnly']         = ! $this->currentUser->hasPrivilege('pr.token.mail.freetext');
            $params['multipleTokenData']    = $tokensData;

            $this->addSnippet('Mail_TokenBulkMailFormSnippet', $params);
        } else {
            $this->addMessage($this->_('No tokens found.'));
        }
    }
1362182
public function sendAction()
    {
        $contactForm = $this->createForm(FrontForm::CONTACT);
        
        try {
            $form = $this->validateForm($contactForm);

            $event = new ContactEvent($form);

            $this->dispatch(TheliaEvents::CONTACT_SUBMIT, $event);

            $this->getMailer()->sendSimpleEmailMessage(
                [ ConfigQuery::getStoreEmail() => $event->getName() ],
                [ ConfigQuery::getStoreEmail() => ConfigQuery::getStoreName() ],
                $event->getSubject(),
                '',
                $event->getMessage(),
                [],
                [],
                [ $event->getEmail() => $event->getName() ]
            );

            if ($contactForm->hasSuccessUrl()) {
                return $this->generateSuccessRedirect($contactForm);
            }
            
            return $this->generateRedirectFromRoute('contact.success');
            
        } catch (FormValidationException $e) {
            $error_message = $e->getMessage();
        }
        
        Tlog::getInstance()->error(sprintf('Error during sending contact mail : %s', $error_message));
        
        $contactForm->setErrorMessage($error_message);
        
        $this->getParserContext()
            ->addForm($contactForm)
            ->setGeneralError($error_message)
        ;
        
        // Redirect to error URL if defined
        if ($contactForm->hasErrorUrl()) {
            return $this->generateErrorRedirect($contactForm);
        }
    }
73471
public function send()
    {
        // if no recipients found, skipping sending
        if (count($this->getRecipient()) < 1) {
            return false;
        }

        $myConfig = Registry::getConfig();
        $this->setCharSet();

        if ($this->_getUseInlineImages()) {
            $this->_includeImages(
                $myConfig->getImageUrl(),
                $myConfig->getImageUrl(false, false),
                $myConfig->getPictureUrl(null, false),
                $myConfig->getImageDir(),
                $myConfig->getPictureDir(false)
            );
        }

        $this->_makeOutputProcessing();

        // try to send mail via SMTP
        if ($this->getMailer() == 'smtp') {
            $ret = $this->_sendMail();

            // if sending failed, try to send via mail()
            if (!$ret) {
                // failed sending via SMTP, sending notification to shop owner
                $this->_sendMailErrorMsg();

                // trying to send using standard mailer
                $this->setMailer('mail');
                $ret = $this->_sendMail();
            }
        } else {
            // sending mail via mail()
            $this->setMailer('mail');
            $ret = $this->_sendMail();
        }

        if (!$ret) {
            // failed sending, giving up, trying to send notification to shop owner
            $this->_sendMailErrorMsg();
        }

        return $ret;
    }
477554
protected function getMailer()
    {
        $mailer = new \PHPMailer();
        
        $SMTPConfig = $this->getOption(self::CONFIG_SMTP_CONFIG);
        
        $mailer->IsSMTP();
        $mailer->SMTPKeepAlive = true;
        $mailer->Debugoutput = 'error_log';
        
        $mailer->Host = $SMTPConfig['SMTP_HOST'];
        $mailer->Port = $SMTPConfig['SMTP_PORT'];
        $mailer->Username = $SMTPConfig['SMTP_USER'];
        $mailer->Password = $SMTPConfig['SMTP_PASS'];
        
        if (isset($SMTPConfig['DEBUG_MODE'])) {
            $mailer->SMTPDebug = $SMTPConfig['DEBUG_MODE'];
        }
        if (isset($SMTPConfig['Mailer'])) {
            $mailer->Mailer = $SMTPConfig['Mailer'];
        }
        if (isset($SMTPConfig['SMTP_AUTH'])) {
            $mailer->SMTPAuth = $SMTPConfig['SMTP_AUTH'];
        }
        if (isset($SMTPConfig['SMTP_SECURE'])) {
            $mailer->SMTPSecure = $SMTPConfig['SMTP_SECURE'];
        }
        
        return $mailer;
    }
182116
public function getLoggedMails($params = array())
    {
        $html             = "";
        $titre            = "<h1>Log des mails du site";
        $sqlSelect        = "";
        $arrayUtilisateur = array();
        if (isset($this->variablesGet['idUtilisateur'])) {
            $u                     = new archiUtilisateur();
            $arrayInfosUtilisateur = $u->getArrayInfosFromUtilisateur($this->variablesGet['idUtilisateur']);
            $sqlSelect             = " AND destinataire='".$arrayInfosUtilisateur['mail']."' ";
            $arrayUtilisateur      = array('idUtilisateur'=>$this->variablesGet['idUtilisateur']);

            // pour le passage de parametres
            $titre .= " pour ".$arrayInfosUtilisateur['nom']." ".$arrayInfosUtilisateur['prenom'];
        }
        $titre .= "</h1>";
        $html .= $titre;

        // gestion de la recherche
        $sqlSelectRecherche = "";
        if (isset($this->variablesGet['recherche']) && $this->variablesGet['recherche']=='1' && isset($this->variablesPost['motCleRechercheLogsMail'])) {
            $motCle                    = $this->variablesPost['motCleRechercheLogsMail'];
            $arraySqlSelectRecherche[] = "destinataire LIKE \"%".$motCle."%\"";
            $arraySqlSelectRecherche[] = "sujet LIKE \"%".$motCle."%\"";
            $arraySqlSelectRecherche[] = "message LIKE \"%".$motCle."%\"";
            $arraySqlSelectRecherche[] = "date LIKE \"%".$motCle."%\"";
            $sqlSelectRecherche        = " AND (".implode(" OR ", $arraySqlSelectRecherche).") ";
        }

        // formulaire de recherche
        $f = new formGenerator();
        $configFields = array("motCleRechercheLogsMail"=>array('type'=>'text', 'htmlCode'=>'', 'error'=>'', 'libelle'=>'Recherche :', 'default'=>'', 'value'=>'', 'required'=>false), "pageCourante"=>array('type'=>'hidden', 'htmlCode'=>'', 'error'=>'', 'default'=>'', 'value'=>'', 'required'=>false));
        if (isset($this->variablesGet['archiAffichage']) && $this->variablesGet['archiAffichage']=='utilisateurDetail') {
            $configForm = array('titrePage'=>'', 'fields'=>$configFields, 'submitButtonValue'=>'Envoyer', 'formAction'=>$this->creerUrl('', 'utilisateurDetail', array_merge(array('recherche'=>1), $arrayUtilisateur)), 'templateFileName'=>'rechercheLogsMail.tpl', 'formName'=>'formRechercheLogsMail');
        } else {
            $configForm = array('titrePage'=>'', 'fields'=>$configFields, 'submitButtonValue'=>'Envoyer', 'formAction'=>$this->creerUrl('', 'afficheLogsMails', array_merge(array('recherche'=>1), $arrayUtilisateur)), 'templateFileName'=>'rechercheLogsMail.tpl', 'formName'=>'formRechercheLogsMail');
        }
        $html                    .= $f->afficherFromArray($configForm);
        $reqCount                 = "SELECT idMail FROM logMails WHERE 1=1 $sqlSelect $sqlSelectRecherche";
        $resCount                 = $this->connexionBdd->requete($reqCount);
        $nbEnregistrementTotaux   = mysql_num_rows($resCount);
        $pagination               = new paginationObject();
        $nbEnregistrementsParPage = 15;
        $arrayPagination          = $pagination->pagination(array('nbEnregistrementsParPage'=>$nbEnregistrementsParPage, 'nbEnregistrementsTotaux'=>$nbEnregistrementTotaux, 'typeLiens'=>'formulaire', 'champPageCourante'=>'pageCourante', 'nomParamPageCourante'=>'pageCourante', 'idFormulaire'=>'formRechercheLogsMail'));
        $req                      = "
                SELECT * 
                FROM logMails 
                LEFT JOIN utilisateur ON utilisateur.mail = logMails.destinataire 
                WHERE 1=1 $sqlSelect $sqlSelectRecherche
        ";

        // on affiche pas les mails de debugs
        $req     = $pagination->addLimitToQuery($req);
        $res     = $this->connexionBdd->requete($req);
        $tableau = new tableau();
        if (!isset($this->variablesGet['idUtilisateur'])) {
            $tableau->addValue("<h3>Destinataire</h3>");
        }
        $tableau->addValue("<h3>Sujet</h3>");
        $tableau->addValue("<h3>Message</h3>");
        $tableau->addValue("<h3>Date</h3>");
        while ($fetch = mysql_fetch_assoc($res)) {
            if (!isset($this->variablesGet['idUtilisateur'])) {
                $tableau->addValue("<a href='".$this->creerUrl('', 'afficheLogsMails', array('idUtilisateur'=>$fetch["idUtilisateur"]))."'>".$fetch["destinataire"]."</a>");
            }
            $tableau->addValue(stripslashes(stripslashes($fetch["sujet"])));
            $tableau->addValue(stripslashes("<textarea style='width:250px;height:150px;'>".stripslashes($fetch["message"]))."</textarea>");
            $tableau->addValue($this->date->toFrench($fetch["date"]));
        }
        $html .= $arrayPagination['html'];
        $nbColonnes = 3;
        if (!isset($this->variablesGet['idUtilisateur'])) {
            $nbColonnes = 4;
        }
        $html .= $tableau->createHtmlTableFromArray($nbColonnes);
        $html .= $arrayPagination['html'];
        return $html;
    }
1356909
public function ajouter()
    {
        $newIdPersonne=0;
        $formulaire = new formGenerator();
        if (isset($this->variablesPost['submit'])) {
            $modeAffichage='';
            if (isset($this->variablesGet['modeAffichage']) && $this->variablesGet['modeAffichage']!='') {
                $modeAffichage = $this->variablesGet['modeAffichage'];
            }


            switch ($modeAffichage) {
                case 'nouveauDossier':
                case "modifEvenement":
                    $tabForm = array(
                    'prenom'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'text'),
                    'nom'        => array('default'=> '',  'value' => '',  'required'=>true, 'error'=>'', 'type'=>'text'),
                    'description'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'text'),
                    'dateNaissance'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'date'),
                    'dateDeces'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'date'),
                    'metier'    => array('default'=> 'aucune' ,  'value' => '',  'required'=>false , 'error'=>'', 'type'=>'numeric',  'checkExist'=>
                                    array('table'=> 'metier',  'primaryKey'=> 'idMetier')));

                    break;

                default:
                    $tabForm = array(
                    'prenom'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'text'),
                    'nom'        => array('default'=> '',  'value' => '',  'required'=>true, 'error'=>'', 'type'=>'text'),
                    'description'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'text'),
                    'nouveauMetier'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'text'),
                    'dateNaissance'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'date'),
                    'dateDeces'    => array('default'=> '',  'value' => '',  'required'=>false, 'error'=>'', 'type'=>'date'),
                    'metier'    => array('default'=> 'aucune' ,  'value' => '',  'required'=>false , 'error'=>'', 'type'=>'numeric',  'checkExist'=>
                                    array('table'=> 'metier',  'primaryKey'=> 'idMetier')));

                    break;
            }
            $erreur = $formulaire->getArrayFromPost($tabForm);

            if (count($erreur) === 0) {
                $prenom = mysql_escape_string($tabForm['prenom']['value']);
                $nom    = mysql_escape_string($tabForm['nom']['value']);
                $description   = isset($_POST['descriptionPerson'])?mysql_escape_string($_POST['descriptionPerson']):mysql_escape_string(htmlspecialchars($tabForm['description']['value']));
                $dateNaissance = $this->date->toBdd($this->date->convertYears($tabForm['dateNaissance']['value']));
                $dateDeces     = $this->date->toBdd($this->date->convertYears($tabForm['dateDeces']['value']));

                /*if (!empty($tabForm['nouveauMetier']['value']))
                {
                    // nouveau metier
                    $nomMetier = mysql_escape_string($tabForm['nouveauMetier']['value']);
                    $sql = "SELECT idMetier FROM metier WHERE nom='".$nomMetier."' LIMIT 1";
                    $rep = $this->connexionBdd->requete($sql);
                    if (mysql_num_rows($rep) === 1)
                    {
                        $res = mysql_fetch_object($rep);
                        $idMetier = $res->idMetier;
                        echo "métier existe";
                    }
                    else
                    {
                        $sql = "INSERT INTO metier (nom) VALUES ('".$nomMetier."')";
                        $this->connexionBdd->requete($sql);
                        $idMetier = mysql_insert_id();
                        echo 'métier existe pas';
                    }
                }
                else if (empty($tabForm['metier']['error']) AND !empty($tabForm['metier']['value']))
                {*/
                    // valeur du select
                    $idMetier      = $tabForm['metier']['value'];
                    //echo 'métier select';
                /*}
                else
                {
                    // choix par défaut
                    $idMetier = 1;
                    echo 'défaut';
                }*/
                $sql ="INSERT INTO personne (prenom,  nom,  dateNaissance,  dateDeces,  description,  idMetier ) VALUES
                    ('".$prenom."', '".$nom."', '".$dateNaissance."', '".$dateDeces."', '".$description."', ".$idMetier.")";


                $this->connexionBdd->requete($sql);

                $newIdPersonne = mysql_insert_id();
            } else {
                $this->erreurs->ajouter($tabForm);
            }
            $this->erreurs->ajouter($tabForm);
        }

        return $newIdPersonne;
    }
222689
public function open()
    {

        //check for mail
        $host = "{" . $this->host . ":" . $this->port . "/" . $this->protocol . "/notls}INBOX";

        //open the mail box for reading
        $this->inbox = \imap_open($host, $this->address, $this->pass);

        if (!$this->inbox) {

            $this->connected = 0;
        } else {

            $this->connected = 1;
        }

        return $this->connected;
    }
410709
public function findUserOrCreateByEmail($email)
    {
        $user = $this->getUserMapper()->findByEmail($email);
        if (empty($user)) {
            // Pas d'utilisateur playground : alors on en crée un
            $user = new UserEntity();
            $user->setEmail($email);
            $rand = \Zend\Math\Rand::getString(8);
            $bcrypt = new Bcrypt;
            $zfcUserOptions = $this->getServiceManager()->get('zfcuser_module_options');
            $bcrypt->setCost($zfcUserOptions->getPasswordCost());
            $pass = $bcrypt->create($rand);
            $user->setPassword($pass);
            $user = $this->getUserMapper()->insert($user);
        }

        return $user;
    }
63806
public function send()
    {
        $result = $this->mailer->send();

        if ( NULL !== $this->dispatcher )
        {
            $event = new SendMailEvent( $this->to, $this->getSubject(), $this->getBody(), $result );

            $this->dispatcher->fire( Events::EVENT_SEND_MESSAGE, $event );
        }

        return $result;
    }
942227
public function toMail()
    {
        return (new MailMessage)
            ->line(trans('pulsar::pulsar.message_reset_password_notification_01'))
            ->action(trans('pulsar::pulsar.reset_password'), route('showResetForm', ['token' => $this->token]))
            ->line(trans('pulsar::pulsar.message_reset_password_notification_02'));
    }
552603
function afficheEdito()
    {
        $html = '';
        $mail = new mailObject();
        $t = new Template('modules/archi/templates/');
        $t->set_filenames(array('edito'=>'edito.tpl'));
        $t->assign_vars(array('email'=>$mail->encodeEmail("fabien.romary@gmail.com")));
        
        ob_start();
        $t->pparse('edito');
        $html .= ob_get_contents();
        ob_end_clean();
        
        return $html;
    }
1222995
public function activation($token,$newsletter_id)
    {
        // Activate the email on the website
        $user = $this->subscription->activate($token);

        if(!$user)
        {
            alert()->danger('Le jeton ne correspond pas ou à expiré');

            return redirect('/');
        }

        $newsletter = $this->newsletter->find($newsletter_id);

        if(!$newsletter)
        {
            alert()->danger('Cette newsletter n\'existe pas');

            return redirect('/');
        }

        //Subscribe to mailjet
        $this->worker->setList($newsletter->list_id);
        $result = $this->worker->subscribeEmailToList($user->email);

        if(!$result){

            alert()->danger('Problème');

            return redirect('/');
        }

        alert()->success('Vous êtes maintenant abonné à la newsletter');

        return redirect('/');
    }