Rowno Posted January 16, 2008 Share Posted January 16, 2008 When I use the following script I made to try and make an e-mail form for a website I don't recieve any of the e-mails created by the script. The HTML page: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <form action="mail.php" method="post"> <table> <tr> <td align="left"> Your Name: </td> <td> <input type="text" name="name"> </td> </tr> <tr> <td align="left"> Your E-mail Address: </td> <td> <input type="text" name="email"> </td> </tr> </table> <p> Message: <textarea name="message" cols="38" rows="10"></textarea> <p> <input type="submit" value="Send"> </form> </body> </html> The PHP page: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> </head> <body> <? function checkOK($field) { if (eregi("\r",$field) || eregi("\n",$field)){ die("Invalid Input!"); } } $name = $_POST['name']; checkOK($name); $email = $_POST['email']; checkOK($email); $message = $_POST['message']; checkOK($message); $to = "my e-mail address here"; $emailmessage = "$name just filled in your e-mail form. They said:\n$message\n\nTheir e-mail address was: $email"; if (mail($to,"E-mail message from Halo 3 Archives",$emailmessage)) { echo "Thanks for your input. <a href=\"website url inserted here\">Back to main website.[/url]"; } else { echo "There was a problem sending the e-mail. Please check that you filled in the form correctly"; } ?> </body> </html> The IF statment comes out 'true' so I presume the e-mail is being sent but I never recieve the e-mails, does anyone know what could be the problem? Quote Link to comment https://forums.phpfreaks.com/topic/86254-solved-e-mail-form-help-needed/ Share on other sites More sharing options...
mmarif4u Posted January 16, 2008 Share Posted January 16, 2008 Did u check your junk folder,if yes and no mail. Then may be your host is blacklisted. Check on multiple sites gmail,yahoo etc Quote Link to comment https://forums.phpfreaks.com/topic/86254-solved-e-mail-form-help-needed/#findComment-440594 Share on other sites More sharing options...
Rowno Posted January 16, 2008 Author Share Posted January 16, 2008 My host isn't blacklisted because I'm still recieving normal e-mails and there isn't anything in the junkmail (I'm using Hotmail by the way). Quote Link to comment https://forums.phpfreaks.com/topic/86254-solved-e-mail-form-help-needed/#findComment-440645 Share on other sites More sharing options...
mmarif4u Posted January 16, 2008 Share Posted January 16, 2008 Hotmail is more secure and highest in threat alert to block emails from hosts. u better try it on other sites,yahoo or gmail. Quote Link to comment https://forums.phpfreaks.com/topic/86254-solved-e-mail-form-help-needed/#findComment-440660 Share on other sites More sharing options...
Rowno Posted January 19, 2008 Author Share Posted January 19, 2008 I tryed gmail, but I'm not receiving them there either. Quote Link to comment https://forums.phpfreaks.com/topic/86254-solved-e-mail-form-help-needed/#findComment-443301 Share on other sites More sharing options...
ratcateme Posted January 19, 2008 Share Posted January 19, 2008 is this your server if so can you find the mail logs find out if he emails are being sent and if so where to Scott. Quote Link to comment https://forums.phpfreaks.com/topic/86254-solved-e-mail-form-help-needed/#findComment-443311 Share on other sites More sharing options...
revraz Posted January 19, 2008 Share Posted January 19, 2008 Check you error log on your server, you may be getting a FROM: required header error. Also, make a new seperate .php file with just the mail() function and required parameters to first verify it works. Quote Link to comment https://forums.phpfreaks.com/topic/86254-solved-e-mail-form-help-needed/#findComment-443315 Share on other sites More sharing options...
Rowno Posted January 20, 2008 Author Share Posted January 20, 2008 Do you need a Domain to send e-mails through php? Cause I'm using a Sub-Domain. Quote Link to comment https://forums.phpfreaks.com/topic/86254-solved-e-mail-form-help-needed/#findComment-444042 Share on other sites More sharing options...
revraz Posted January 20, 2008 Share Posted January 20, 2008 You need a Mail Server Quote Link to comment https://forums.phpfreaks.com/topic/86254-solved-e-mail-form-help-needed/#findComment-444049 Share on other sites More sharing options...
werty37 Posted January 20, 2008 Share Posted January 20, 2008 Hi Sometimes webhosting companies disable mail() function by default. You might have to contact your hosting company to enable them... Regards Sujith Quote Link to comment https://forums.phpfreaks.com/topic/86254-solved-e-mail-form-help-needed/#findComment-444206 Share on other sites More sharing options...
Rowno Posted January 20, 2008 Author Share Posted January 20, 2008 I figured out why the e-mails aren't getting sent, the TO or FROM has to contain an e-mail address hosted on my webhost for it to be sent which means I need a Domain, so it's not going to work anytime soon. Quote Link to comment https://forums.phpfreaks.com/topic/86254-solved-e-mail-form-help-needed/#findComment-444641 Share on other sites More sharing options...
revraz Posted January 20, 2008 Share Posted January 20, 2008 Do you get any email accounts with the subdomain? It should accept the parent name just fine as a FROM address. Quote Link to comment https://forums.phpfreaks.com/topic/86254-solved-e-mail-form-help-needed/#findComment-444653 Share on other sites More sharing options...
Rowno Posted January 24, 2008 Author Share Posted January 24, 2008 No, I didn't. But I signed up to a byethost sub-domain and this script works there fine. Quote Link to comment https://forums.phpfreaks.com/topic/86254-solved-e-mail-form-help-needed/#findComment-447644 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.