Hello all:
Here is my code
Code:
#!/usr/local/bin/php -q
<?
include ("/home/someuser/somedirectory/databaseinfo.inc.php"); // stores db username, passwords, connection, etc
$query="SELECT * FROM table1 WHERE status = 'new' ORDER BY id DESC"; // selects only records flagged as new
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
echo "Database Output\n\n";
$i=0;
while ($i < $num)
{
$name=mysql_result($result, $i, "name");
$email=mysql_result($result, $i, "email");
$user=mysql_result($result, $i, "type");
$company=mysql_result($result, $i, "company");
$comment=mysql_result($result, $i, "comment");
$datetime=mysql_result($result, $i, "datetime");
echo "Name: ".$name."\n".
"Email: ".$email."\n".
"User Type: ".$user."\n".
"Company: ".$company."\n".
"Comment: ".$comment."\n".
"Date: ".$datetime."\n";
$to = "some@emailaddress.com";
$subject = "Contact from ".$email;
$body= "Name: ".$name."\n".
"Email: ".$email."\n".
"User Type: ".$user."\n".
"Company: ".$company."\n".
"Comment: ".$comment."\n".
"Date: ".$datetime."\n>";
mail($to, $subject, $body);
echo "Message sent on ".date("r")."\n\n";
$i++;
}
?>
Almost everything runs properly, but i get error
Code:
sh: line 1: -t: command not found
which refers to the line of code
Code:
mail($to, $subject, $body);
and of course, the email does not go out.
What is the problem and how can I correct it?