Roopavathy Posted January 20, 2014 Share Posted January 20, 2014 Hi, Here is my site :http://bhc.edu.in/COMMCOLLEGE/index.php I have written code for sending email (The form is in footer). But every time when the page is loaded,it shows the message "Your feedback or enquiry is sent successfully". And i am getting empty mail to my email id.Please help,what should i do? Quote Link to comment https://forums.phpfreaks.com/topic/285514-sending-email/ Share on other sites More sharing options...
requinix Posted January 20, 2014 Share Posted January 20, 2014 what should i do?Post your code. Quote Link to comment https://forums.phpfreaks.com/topic/285514-sending-email/#findComment-1465838 Share on other sites More sharing options...
Roopavathy Posted January 20, 2014 Author Share Posted January 20, 2014 <section class="contform"> <h3>FOR ENQUIRIES</h3> <form action="index.php" method="post" name="Contact" class="contact"> <label class="labelformat">Name :</label> <input name="Name" type="text" maxlength="50" class="txt" /><br /> <label class="labelformat">E-mail :</label> <input name="email" type="text" maxlength="100" class="txt" /><br /> <label class="labelformat">Enquiry:</label> <textarea name="message" class="txt" cols="15" rows="2"></textarea> <input class="txt" name="Submit" type="button" value="Send" /> </form> <script type="text/javascript"> <?php if(isset($_REQUEST['email']) && isset($_REQUEST['message'])) { $to="kiruthigabaskaran@gmail.com"; $subject="Feedback/Enquiry"; $mail=$_REQUEST['email']; $message=$_REQUEST['message']; $header="From:$mail"; $send=mail($to,$subject,$message,$header); if($send) { echo "alert('Your feedback or enquiry is sent successfully!');"; } else { echo "alert('Enter all the fields properly!');"; } } ?> </script> </section> Quote Link to comment https://forums.phpfreaks.com/topic/285514-sending-email/#findComment-1465840 Share on other sites More sharing options...
Roopavathy Posted January 21, 2014 Author Share Posted January 21, 2014 Please check my code.After using the "if condition" i dont receive any messages but after filling the field i dont receive any emails to my e-mail id. Quote Link to comment https://forums.phpfreaks.com/topic/285514-sending-email/#findComment-1465973 Share on other sites More sharing options...
cyber_alchemist Posted January 21, 2014 Share Posted January 21, 2014 (edited) code after if condition is okay i guess. should check the code before. or send a simple mail without the query form with variables in code and check if mail() is working or not. $to="kiruthigabaskaran@gmail.com"; $subject="Feedback/Enquiry"; $mail="test@email.com"; $message="test message" ; $header="From:$mail"; $send=mail($to,$subject,$message,$header); if($send) { echo "alert('Your feedback or enquiry is sent successfully!');"; } else { echo "alert('Enter all the fields properly!');"; } most probably it may be server problem. :x Edited January 21, 2014 by cyber_alchemist Quote Link to comment https://forums.phpfreaks.com/topic/285514-sending-email/#findComment-1465974 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.