0

When i click on Confirm for sending email, i got message "www..... is currently unable to handle this request"... Is my code bad,or its about hosting server ? Thanks

<div class="contactform" data-aos="fade-right" data-aos-offset="300">      
       
       <div id="form" class="form">
          <h3>Kontakt oss</h3>
          <form class='formclass' method="POST" action="contact.php">
          <input name="name" type="text" placeholder="First Name" required>
          <input type="text" placeholder="Last Name" required>
          <input name="email" type="email" placeholder="E-mail" required>
          <textarea name="message"  placeholder="Message" required></textarea>
          <input id="confbtn" type="submit" value="CONFIRM" class='confbtn'>
          <div>
            <p>Isbjorn</p>
            
            </div>
          </form> 
        </div>
      </div>

contact.php

<?php
$name = $_POST['name'];
$visitor_email = $_POST['email'];
$message = $_POST['message'];

$email_from = 'contactform@companyname.no';

$email_subject = "New Form Submission";

$email_body = "User Name: $name.\n".
                "User Email: $visitor_email.\n."
                 "User Message: $message.\n";

$to = "myemail@yahoo.com";

$headers = "From: $email_from \r\n";

$headers = "Reply-To": $visitor_email \r\n";

mail($to,$email_subject,$email_body,$headers);

header("Location: index.html");

?>
t3rror
  • 13
  • 5
  • This is basically a 500 error message, which is a generic error message and covers pretty much every single thing that can go wrong with a PHP script. Check your server error logs to find out the exact error message. However, you have a syntax issue with an extra double-quote on line 18, you're `Reply-To` line, as well as a misplaced period on line 11, breaking your concatenation. An IDE/Editor with syntax highlighting and error checking will go a long way to finding these issues. – aynber Jan 03 '22 at 16:07
  • I fixed php code, removed dobule quote,and moved period on its place.... now its working -.- Thanks a lot – t3rror Jan 03 '22 at 16:18

0 Answers0