0

I am trying to develop a contact form and to have a little verification through php. After the verifying part I'm trying to send a mail to my account and even if the form is submitted the mail still don't come.

    <?php
$to = 'reciever@email.com';
$subject = 'This is the subjcet';
$message = 'This is the message';

mail($to,$subject,$message);

?>

I just posted the part of sending the mail. I have to mention that the page is hosted through a free web hosting service.

  • 2
    Check the error log, it should tell you why it's failing. Possibly no SMTP enabled on your web server, or no default from address specified (which can be specified in the fourth parameter as part of the header). –  Sep 09 '15 at 21:52
  • What Mark has said, plus, you're not even checking to see if mail() worked? $success = mail($to,$subj,$msg);if ($success) echo "Y"; and so on... – Kevin_Kinsey Sep 09 '15 at 21:57
  • also might be helpful if you enabled php errors while debugging. – devlin carnate Sep 09 '15 at 21:59
  • I just tried it and says undefined variable on some lines.. But thus are the name of the form elements –  Sep 09 '15 at 22:05
  • Umm... What? There aren't any undefined variables here - are you looking at the console in your browser, or the PHP log on the server? –  Sep 09 '15 at 22:14

0 Answers0