I wonder if somebody can help me please. I've got a database were people add their email addresses and a random number. I've got a cron (to run every minute while I'm testing it) to email the email addresses depending on what number they're entered. In general it works but I keep on getting this email from the server log:
Quote:
This is the mail system at host localhost.mydomain.com.
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
For further assistance, please send mail to <postmaster>
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
The mail system
<1@localhost. mydomain.com> (expanded from <1>): unknown user: "1"
Section: 2 Keywords: 7bit - 1 k
Reporting-MTA: dns; localhost.mydomain.com
X-Postfix-Queue-ID: 9105E101D73
X-Postfix-Sender: rfc822; root@localhost.mydomain.com
Arrival-Date: Tue, 21 Oct 2008 16:26:01 +0100 (BST)
Final-Recipient: rfc822; 1@localhost.mydomain.com
Original-Recipient: rfc822; 1
Action: failed
Status: 5.1.1
Diagnostic-Code: X-Postfix; unknown user: "1"
Section: 3.1 Keywords: plain 7bit - 1 k
The number you selected is shared with at least one other person.
|
The cron file is:
PHP Code:
<?php
error_reporting(E_ALL ^ E_NOTICE);
$headers = 'From: info@mydomain.com' . "\r\n" .
'Reply-To: info@ mydomain.com';
$con = mysql_connect("hostname","username","password");
$first = TRUE;
mysql_select_db("dbname", $con);
$result = mysql_query("SELECT * FROM table");
while ($row = mysql_fetch_row($result))
{
$email = $row['1'];
$number = $row['2'];
$resultnr = mysql_query("SELECT * FROM table WHERE number= " .$number);
$count = mysql_num_rows($resultnr);
if ($count == 1)
{
mail($email, "Your number is unique", "Congratulations the number you have entered is unquie number", $headers);
if ($first)
{
$lowest = $number;
$first = FALSE;
}
else
{
if ($number < $lowest)
{
$lowest = $number;
}
}
}
else
{
mail($email, "You share your number", "The number you selected is shared with at least one other person.", $headers);
}
}
$result = mysql_query("SELECT * FROM table WHERE number =".$lowest);
$row = mysql_fetch_row($result);
$email = $row['1'];
mail($email, "You have the lowest unquie number", "Congratulations you have entered the lowest unquie number", $headers);
mysql_close($con);
?>
The only fields in the database are ID, email and number, but I'm not sure why. I keep on getting these emails (every minute  ) so would be grateful for any help please.
Thanks
|