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 <[email protected]>"; $to = "[email protected]"; $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. Link to comment https://forums.phpfreaks.com/topic/45752-problem-with-mail/ 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 Link to comment https://forums.phpfreaks.com/topic/45752-problem-with-mail/#findComment-222224 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 [email protected] [email protected] 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? Link to comment https://forums.phpfreaks.com/topic/45752-problem-with-mail/#findComment-222321 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 <[email protected]>"; $to = "[email protected]"; $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"; } ?> Link to comment https://forums.phpfreaks.com/topic/45752-problem-with-mail/#findComment-222326 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. Link to comment https://forums.phpfreaks.com/topic/45752-problem-with-mail/#findComment-222341 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 Link to comment https://forums.phpfreaks.com/topic/45752-problem-with-mail/#findComment-222354 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? Link to comment https://forums.phpfreaks.com/topic/45752-problem-with-mail/#findComment-222360 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.