0
<?php


      $receiving_email_address = 'info@info.com';
      $name = strip_tags(htmlspecialchars($_POST['name']));
      $email_address = strip_tags(htmlspecialchars($_POST['email']));

      // 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'];

    $to      = $receiving_email_address;
    $subject = $_POST['subject'];
    $message = $_POST['message'];
     //$headers = 'From: {$_POST["name"]}' . "\r\n" .
     //   'Reply-To: {$_POST["email"]}' . "\r\n" .
       // 'X-Mailer: PHP/' . phpversion();
    $headers = "Content-Type: text/plain; charset=utf-8" . "\r\n";
    $headers .= "MIME-Version: 1.0" . "\r\n";
    $headers .= "Content-Transfer-Encoding: base64" . "\r\n";
    $headers .= "Date: ".date("r (T)") . "\r\n";
    $headers .= "From: info.com <info@info.com>" . "\r\n";
    $headers .= "Reply-To: $name <$email_address>";


    $result=mail($to, $subject, $message, $headers); 

    if($result==1)
      echo "OK";
      else 
       echo "Meddelandet har inte skickats.  <br>Kontrollera din internetanslutning och skicka igen.";
      // 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();
    ?>

These are the symbols I get when I use the contact form...

This is the email I get and it should be formated like: Name-Subject-email-message

I tried some methods but wasnt successful hopefully we can fix this soons. Thank you all in advance! I tried some methods but wasnt successful hopefully we can fix this soons. Thank you all in advance! I tried some methods but wasnt successful hopefully we can fix this soons. Thank you all in advance!

filip1337
  • 37
  • 7

0 Answers0