samedi 20 novembre 2021

Unable to load the "PHP Email Form" Library

Hi guys for some reason my PHP Form doesnt work, when someone press send message button this error pop out "Unable to load the "PHP Email Form" Library". I dont know whats the problem. Can you help me ? :)

This is contact.php

<?php

    $receiving_email_address = 'myemailadress';
    
      if( file_exists($php_email_form = '../assets/vendor/php-email-form/php-email-form.php' )) {
        include( $php_email_form );
      } else {
        die( 'Coming Soon!');
      }
    
      $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' => 'example.com',
        'username' => 'example',
        'password' => 'pass',
        'port' => '587'
      );
      */
    
      $contact->add_message( $_POST['name'], 'From');
      $contact->add_message( $_POST['email'], 'Email');
      $contact->add_message( $_POST['message'], 'Message', 10);
    
      echo $contact->send();
    ?>

This is index.html

 <div class="form">
              <form action="forms/contact.php" method="post" role="form" class="php-email-form">
                <div class="row">
                  <div class="form-group col-md-6">
                    <input type="text" name="name" class="form-control" id="name" placeholder="Your Name" required>
                  </div>
                  <div class="form-group col-md-6 mt-3 mt-md-0">
                    <input type="email" class="form-control" name="email" id="email" placeholder="Your Email" required>
                  </div>
                </div>
                <div class="form-group mt-3">
                  <input type="text" class="form-control" name="subject" id="subject" placeholder="Subject" required>
                </div>
                <div class="form-group mt-3">
                  <textarea class="form-control" name="message" rows="5" placeholder="Message" required></textarea>
                </div>
                <div class="my-3">
                  <div class="loading">Loading</div>
                  <div class="error-message"></div>
                  <div class="sent-message">Your message has been sent. Thank you!</div>
                </div>
                <div class="text-center"><button type="submit">Send Message</button></div>
              </form>
            </div>

Anf for some reason some kind of a error log file came up in the folder that says:

[19-Nov-2021 13:49:31 UTC] PHP Fatal error:  Uncaught Error: Class 'PHP_Email_Form' not found in /home/domain/public_html/forms/contact.php:16
Stack trace:
#0 {main}
  thrown in /home/domain/public_html/forms/contact.php on line 16
[19-Nov-2021 13:49:32 UTC] PHP Fatal error:  Uncaught Error: Class 'PHP_Email_Form' not found in /home/domain/public_html/forms/contact.php:16
Stack trace:
#0 {main}
  thrown in /home/domain/public_html/forms/contact.php on line 16

I guess i should add this home/domain/public.html/froms/contact.php on line 16 but I dont know how to that properly apparently.

Can you help me please ?




Aucun commentaire:

Enregistrer un commentaire