taimoortwm Posted September 13, 2015 Share Posted September 13, 2015 contact.phpHi, guys, I am very new to the PHP and Websit building. I have made a Contact page, but it isn't working. Please help! Thanks a lot! Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted September 13, 2015 Share Posted September 13, 2015 Explain what you mean by "isn't working" Quote Link to comment Share on other sites More sharing options...
taimoortwm Posted September 13, 2015 Author Share Posted September 13, 2015 When I click the "send" button, it didn't send the email to my mail box. Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted September 13, 2015 Share Posted September 13, 2015 Where are you running this code form? localhost? If so then you need to configure PHP to use an SMTP server/mail client in order for emails to be sent. See the following page for configuration options available http://php.net/manual/en/mail.configuration.php If your SMTP server requires authentication (ie google mail, yahoo, outlook etc) before sending emails then you cannot use PHP's mail function. Instead you need to use a something like PHPMailer or Swiftmailer. Quote Link to comment Share on other sites More sharing options...
taimoortwm Posted September 13, 2015 Author Share Posted September 13, 2015 I am using hostgator.com to host my site, but they say it is my code problem. They can't help me. It sounds like I need the PHPMailer. Do I need to google that program? Sorry, I know the questions sounds stupid. Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted September 13, 2015 Share Posted September 13, 2015 If you are running the code from your website then the email is most likely being sent, but is most likely being flagged as spam in your inbox, so check your spam folder Do I need to google that program? I already provided a link. Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted September 13, 2015 Share Posted September 13, 2015 what result are you getting in the browser, the contactthanks.php page or the error.htm page? Quote Link to comment Share on other sites More sharing options...
taimoortwm Posted September 13, 2015 Author Share Posted September 13, 2015 I haven't design those pages yet, since it s not sending any email to my mail box. Do I need to up load those pages? I could just make up a dummy page for now. Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted September 13, 2015 Share Posted September 13, 2015 you need an indication of the value being returned by the mail() function. for the time being, forget about redirecting all over the place. start with something like - if ($success){ echo "the mail statement returned a TRUE value"; } else{ echo "the mail statement returned a FALSE value"; } i looked at the hostgator faq concerning php/sendmail and apparently the mail() statement can be used to send email through their mail server, though i wouldn't use their example code, it's just more crap php code that's been posted on the web. Quote Link to comment Share on other sites More sharing options...
taimoortwm Posted September 13, 2015 Author Share Posted September 13, 2015 Staff Alumni, Thank you for your advice, and I will change the code. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.