BadGoat Posted April 5, 2007 Share Posted April 5, 2007 Heya! I am having a problem with a simple mail script... It doesn't send! I have PHP5 installed on our company webserver. Our website is ASP-based, and there are a few ASP scripts which send emails successfully. This server hosted some older PHP scripts which used to mail stuff out also, and I tried to test the mail using the old scripts and they fail as well. So while I admit to being a nooblet, I would think that the server is set up to email correctly... ? So far, none of the PHP scripts have worked out, including the FreakMailer mail tutorial, which I tried this morning. I am not sure what I need to check next. My simple little email script is below. This page <?php $connect = mssql_connect("***","***", "***") or die("Could not connect"); $result = mssql_select_db("***") or die("Could not select that database !"); error_reporting(0); // To send HTML mail, the Content-type header must be set $from = "From: Form Results <test@domain.com>"; $to = "badgoat@domain.com"; $subject = "TEST"; $body = ($_POST['name'] . "\r" . $_POST['phone'] . "\r" . $_POST['email'] . "\r" . $_POST['comments'] . "\r\n"); $email=$_POST['email']; if(mail($from,$to,$subject,$body)) echo "Data Recieved Successfully"; else echo "MAIL FAILED"; ?> Might it be a problem with the PHP.ini file? Would I be better off trying to get the admin to allow me to install Apache? Any suggestions would be most appreciated, I am sincerely stuck. Quote Link to comment Share on other sites More sharing options...
only one Posted April 5, 2007 Share Posted April 5, 2007 check phpinfo(); and see if the mail function is on Quote Link to comment Share on other sites More sharing options...
BadGoat Posted April 5, 2007 Author Share Posted April 5, 2007 Here are all the variables associated with mail: mail.force_extra_parameters no value no value sendmail_from scheduling@domain.com scheduling@domain.com sendmail_path no value no value Internal Sendmail Support for Windows enabled SMTP localhost localhost smtp_port 25 25 I would guess that mail is enabled... Is that correct? Quote Link to comment Share on other sites More sharing options...
only one Posted April 5, 2007 Share Posted April 5, 2007 im not sure :-\, dont forget to put {s after you open a function (edited lol, wtf is a finction ???) <?php $connect = mssql_connect("***","***", "***") or die("Could not connect"); $result = mssql_select_db("***") or die("Could not select that database !"); error_reporting(0); // To send HTML mail, the Content-type header must be set $from = "From: Form Results <test@domain.com>"; $to = "badgoat@domain.com"; $subject = "TEST"; $body = ($_POST['name'] . "\r" . $_POST['phone'] . "\r" . $_POST['email'] . "\r" . $_POST['comments'] . "\r\n"); $email=$_POST['email']; if(mail($from,$to,$subject,$body)){ echo "Data Recieved Successfully"; }else{ echo "MAIL FAILED"; } ?> Quote Link to comment Share on other sites More sharing options...
BadGoat Posted April 5, 2007 Author Share Posted April 5, 2007 Thank you only one for looking, just tried your recommendation, didn't work I am still getting the MAIL FAILED message. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 5, 2007 Share Posted April 5, 2007 Replace <?php error_reporting(0); ?> with <?php error_reporting(E_ALL); ?> And see what error PHP is reporting. That will be helpful in debugging your problem. Ken Quote Link to comment Share on other sites More sharing options...
BadGoat Posted April 5, 2007 Author Share Posted April 5, 2007 Hi Ken, I made that change and there are no errors still. Would that indicate that it's an issue elsewhere? 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.