Setting the "name" of the "sender" of an email
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 no-reply@domain.com 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, "no-reply@domain.com");
}else{
// no rows found.
}
}
else
{
//your subcheck is not 1 / nothing was found
}
Just add FROM:
so your code will be like this:
mail($mailaddress, "Someone has commented on your submission
$submission.", $comment, "FROM: no-reply@domain.com");
精彩评论