1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Error on contact form!

Discussion in 'PHP & Perl' started by Dodge, Aug 18, 2015.

  1. Dodge

    Dodge Regular Member

    Joined:
    Jul 29, 2009
    Messages:
    389
    Likes Received:
    53
    Hi there,

    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, I'd really appreciate if anyone can advise me on how to fix.

    Thanks

     
  2. CrazyTorMan

    CrazyTorMan Newbie

    Joined:
    Sep 11, 2015
    Messages:
    35
    Likes Received:
    2
    It might be two reasons. 1, you don't have the PHP mail function enabled. 2, PHP has no way of sending mail because you don't have sendmail installed.

    Are you hosting this on a web host or VPS?

    What operating system if it's a VPS?
     
  3. laowai

    laowai Power Member

    Joined:
    Feb 27, 2011
    Messages:
    522
    Likes Received:
    185
    Remove the @ character and you should see the real error message
     
  4. mantic0re

    mantic0re Junior Member

    Joined:
    May 29, 2015
    Messages:
    118
    Likes Received:
    9
    An error occured. Please try again later is not an error message. It is just something that your script prints for you if the mail function returns false. You should indeed remove the '@' from (@mail($email_to, $email_subject, $email_message, $headers)). If it still returns false you most likely don't have an smtp server to relay your email.
     
  5. revproxy

    revproxy BANNED BANNED Jr. VIP Premium Member

    Joined:
    Nov 20, 2015
    Messages:
    396
    Likes Received:
    101
    Gender:
    Male
    check iptables or try to disable the service for 2 minutes to see if this is the problem
     
  6. revproxy

    revproxy BANNED BANNED Jr. VIP Premium Member

    Joined:
    Nov 20, 2015
    Messages:
    396
    Likes Received:
    101
    Gender:
    Male
    also check the mail logs in /var/log - in 99% that the solution found in the logs