runei Posted September 4, 2008 Share Posted September 4, 2008 Hello! I am fairly new to PHP and i got a problem with my mail form. The form is very basic and i just wanted to test it out. This is the form: <html> <head> <title>E-mail</title> </head> <body> <form action="mail.php" method="post"> Name:<br> <input type="text" name="name"><br> Subject:<br> <input type="text" name="subject"><br> Message:<br> <textarea cols="40" rows="4" name="message"></textarea><br> <input type="submit" value="Send mail" name="submit"> </form> </body> </html> $name = $_POST['name']; $subject = $_POST['subject']; $message = $_POST['message']; $to = "[email protected]"; $sendMessage = $name . $message; if ($name && $subject && $message) { mail($to,$subject,$sendMessage); echo "Mail sent"; } else { echo "Mail not sent"; } ?> All this works fine, i tested it with a freehosting site and i got the mail i sent from my web site in my inbox right away. Then i bought a domain with a hosting plan at freehostia uploaded the exact same files but now i dont get the mail. I sent multiple mails to freehostia asking if they had support for this feature before i upgraded to a hosting plan, they said i had to upgrade my hosting plan but i still dont get it work and they have stopped answering my mails :-\ . I also have a domain at Godaddy which i am hosting for free but i got the same problem there, i am not getting the mail i am sending from my website. I saw the gdform.asp in the root directory but i am using php so.... ??? I had to send them a mail as well (very frustrated at this point) and this is the answer i got : "Thank you for contacting Online Support in regards to the use of a email form mailer on your hosting account. Windows IIS 7 shared hosting accounts run PHP 5, allowing you to install a variety of PHP 5 quick-install applications and integrate PHP 5 scripts and code into your site. PHP 5 technical support is available for accounts running IIS 7. PHP support for IIS 6 Windows shared hosting accounts has been deprecated. PHP runs in Safe Mode on IIS 6 shared hosting servers, and we no longer offer PHP technical support for IIS 6 shared hosting accounts. Please let us know if you have any additional questions. " I am at loss what to do. Can anyone help? I am a newbie to PHP so i know i am messing something up Link to comment https://forums.phpfreaks.com/topic/122681-mail-form-need-help/ Share on other sites More sharing options...
DjMikeS Posted September 4, 2008 Share Posted September 4, 2008 create a file and put: <?php phpinfo(); ?> in it to see if the mail function is enable and functional... Link to comment https://forums.phpfreaks.com/topic/122681-mail-form-need-help/#findComment-633506 Share on other sites More sharing options...
burn1337 Posted September 4, 2008 Share Posted September 4, 2008 Well one thing I see that could be a little something is your if statement, you have no argument, some servers may not process it because of that, I would suggest adding an isset to your variables, I would also set the mail function to a variable then do a boolean check on the variable just to make sure the email is being sent. Also I understand your fustration with all those hosting places, I tried having a host. Then decided I prefur hosting my site myself lol. Also I would add an input for your "to" field. Sometimes email carriers will deny ips from sending mail to their networks, as well as sometimes some of those hosts may have an email area they give you, and deny httpd/php from sending emails because of how easy it is for someone to inject, or cross site it ect. Also they could have some certain security percautions that your script would have to meet before allowing that (policies taken to prevent those actions). Link to comment https://forums.phpfreaks.com/topic/122681-mail-form-need-help/#findComment-633508 Share on other sites More sharing options...
runei Posted September 4, 2008 Author Share Posted September 4, 2008 Thx for your quick replies, I'll give it a try Btw, this is the link to my phpinfo: http://runeingulfsvann.com/phpinfo.php Dont bother trying to send me a mail, im not getting it anyways...yet Link to comment https://forums.phpfreaks.com/topic/122681-mail-form-need-help/#findComment-633517 Share on other sites More sharing options...
burn1337 Posted September 4, 2008 Share Posted September 4, 2008 Dude I would take that link off, never publicly post your phpinfo, that just lets everyone know what they can do to exploit your system... Link to comment https://forums.phpfreaks.com/topic/122681-mail-form-need-help/#findComment-633529 Share on other sites More sharing options...
runei Posted September 4, 2008 Author Share Posted September 4, 2008 ok, i deleted it of the server Link to comment https://forums.phpfreaks.com/topic/122681-mail-form-need-help/#findComment-633533 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.