Link to home
Start Free TrialLog in
Avatar of Bruce Gust
Bruce GustFlag for United States of America

asked on

What's wrong with this email script?

This code works fine on my server, but when I take it over to my client's server, while there are no errors, no email is delivered. What am I missing?

<?php
$from_email="bruce@brucegust.com";
$to = "bruce@brucegust.com";
$subject = "test";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
$headers .= "From:";
$headers .= $from_email;
$headers .=  "\r\n";
$message = "awesome";
mail($to, $subject , $message, $headers);

echo "done";
?>
SOLUTION
Avatar of Chris Sandrini
Chris Sandrini
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bruce Gust

ASKER

I tried the "if" statement above and I got, "error." Since the code works on other servers, what does that mean? Is it that php.ini file dynamic that has to be considered now?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
"phpinfo()" will tell you what is set for your SMTP connection.  Save this and run it on that server to see what it says.  What kind of web server is it?  Apache?  IIS? nginx?  And what hosting company?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>PHP Check</title>
</head>
<body>
<p>PHP Check</p>
<?php phpinfo() ?>
<?php phpversion() ?>
</body>
</html>

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As it turned out, the server wasn't set up to deliver email. Once I was able to determine that conclusively, thanks to your input, we got it taken care of.