tags:

views:

42

answers:

1

Hello,

The code below is supposed to send out an email if a comment is made on a submission where a certain condition is met (subcheck = 1). It works fairly well.

However, the "name" of the sender that shows up is two 7-digit numbers separated by a dot. How could I make the name of the sender something else, like [email protected] for example?

Thanks in advance,

John

$querye = mysql_query("SELECT subcheck FROM submission WHERE subcheck = '1' AND submissionid = '$submissionid' ");

if (mysql_num_rows($querye) == 1)
{

$email_query = "SELECT email FROM login WHERE username = '$submittor'";
$result = mysql_query($email_query);
if (!$result) {
        trigger_error('Invalid query: ' . mysql_error()." in ".$email_query);
}

if($row = mysql_fetch_assoc($result)) {
        $mailaddress = $row['email'];
        $queryem = mail($mailaddress, "Someone has commented on your submission 
                        $submission.", $comment, "[email protected]");
}else{
        // no rows found.
}

}
else
{
//your subcheck is not 1 / nothing was found
}
+4  A: 

Just add FROM: so your code will be like this:

mail($mailaddress, "Someone has commented on your submission 
                        $submission.", $comment, "FROM: [email protected]");
Adnan