PHP-FORM-EMAIL

Bonjour,

J'ai téléchargé un template et je l'ai modifié maintenant les formulaires ne redirigent pas vers les mails on me demande de mettre une librairie php-form-email et je sais pas comment créer cela pouvez vous m'aidez avec un code svp?


Macintosh / Safari 16.2

1 réponse

  1. Modérateur

    Bonjour, librairie php-form-email  .. inconnu au bataillons ...

    Qui est le "on" dont tu parles ?

    Travailles tu en local sur ton ordi ou bien tes pages sont hébergées sur un serveur web ?

    Si en "local", qu'utilises tu pour émuler un serveur web ?

    Où as tu trouvé ce code ? Peux tu nous le partager ?

    NB: Pour nous montrer ton code, merci d'appliquer ceci : https://codes-sources.commentcamarche.net/faq/11288-poster-un-extrait-de-code


    1. <?php
        /**
        * Requires the "PHP Email Form" library
        * The "PHP Email Form" library is available only in the pro version of the template
        * The library should be uploaded to: vendor/php-email-form/php-email-form.php
        * For more info and help: https://bootstrapmade.com/php-email-form/
        */

        // Replace ***@*** with your real receiving email address
        $receiving_email_address = '***@***';

        if( file_exists($php_email_form = '../assets/vendor/php-email-form/php-email-form.php' )) {
          include( $php_email_form );
        } else {
          die( 'Unable to load the "PHP Email Form" Library!');
        }

        $contact = new PHP_Email_Form;
        $contact->ajax = true;
        
        $contact->to = $receiving_email_address;
        $contact->from_name = $_POST['name'];
        $contact->from_email = $_POST['email'];
        $contact->subject = $_POST['subject'];

        // Uncomment below code if you want to use SMTP to send emails. You need to enter your correct SMTP credentials
        
        $contact->smtp = array(
          'host' => 'mail53.lwspanel.com',
          'username' => '***@***',
          'password' => 'mB4!_UWmJMGtTB@',
          'port' => '587'
        );
        

        $contact->add_message( $_POST['name'], 'From');
        $contact->add_message( $_POST['email'], 'Email');
        $contact->add_message( $_POST['message'], 'Message', 10);

        echo $contact->send();
      ?>
       

    2. Modérateur
      @josephkan

      Bon.. déjà ... tu n'as pas été lire le lien que je t'ai donné et qui explique comment poster du code correctement sur le forum ...

      Ensuite..... la réponse à ta question se trouve dans les commentaires du code que tu as téléchargé :

        * Requires the "PHP Email Form" library
        * The "PHP Email Form" library is available only in the pro version of the template
        * The library should be uploaded to: vendor/php-email-form/php-email-form.php
    3. Modérateur
      @jordane45

      Maintenant, rien ne t'empêche de modifier le code et d'utiliser, à la place, la librairie phpmailer

      Tu la trouveras sans mal sur internet ainsi que de nombreux exemples pour l'utiliser.