Jump to content

Problem with MAIL


BadGoat

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.