0

I know nothing about coding/PHP, and am running into an error message when trying to use the contact form included on my website. I've been unable to get in touch with the web designer, and would really appreciate if someone could help out - I'm presuming the error is something that can be easily fixed.

When a form is submitted it comes up with the error: "An error occured. Please try again later" - I have no idea why!

I have included the full mail.php code here:http://codepad.org/OJrdKDri

I'd really appreciate if anyone can advise me on how to fix.

Thanks

SideB
  • 3
  • 2
  • On line 86, try removing the @, that should show the error why mail is not working and give us some more info – Werring Aug 18 '15 at 20:23
  • I would check all these variables: `$email_to, $email_subject, $email_message, $headers` perhaps you can provide the contents of these – CodeGodie Aug 18 '15 at 20:23
  • I tried removing the @, but still get same mail. Sorry to say but don't understand what to do in regards to checking the variables - I really no nothing about coding, I am trying to start learning... I didn't do any of the coding, and the guy who did is ignoring me! Thanks for the quick responses! – SideB Aug 18 '15 at 20:26
  • before this line `if (@mail($email_to, $email_subject, $email_message, $headers)) {` do this: `var_dump($email_to); var_dump($email_subject); var_dump($email_message); var_dump($headers); ` then run your site and you will see some results printed in your screen. copy that and show us here – CodeGodie Aug 18 '15 at 20:27
  • also on the top of your php code add this: `error_reporting(-1);` to turn on error reporting, this will give you a good idea of the errors you are having – CodeGodie Aug 18 '15 at 20:30
  • Tried that both and still getting the exact same error :/ – SideB Aug 18 '15 at 20:31
  • Probably mail() function is not enabled on your hosting. – sinisake Aug 18 '15 at 20:31
  • Should it not be automatically enabled? I am hosting with Namecheap, but I will contact them now to ask! – SideB Aug 18 '15 at 20:33
  • 1
    also check this out: http://stackoverflow.com/questions/24644436/php-mail-form-doesnt-complete-sending-e-mail your answer might be there – CodeGodie Aug 18 '15 at 20:39
  • Checked it out , the "mail()" line was missing so I put that in at the top, but still no change! – SideB Aug 18 '15 at 20:44
  • My hosting support said the smtp server details are missing but I have no idea where to enter these - can someone advise! Thanks!! – SideB Aug 18 '15 at 21:18

0 Answers0