2010-09-14 74 views
2

如果在滿足特定條件(子檢查= 1)的提交中發表評論,則下面的代碼應發送電子郵件。它工作得很好。設置電子郵件的「發件人」的「姓名」

但是,顯示的發件人的「姓名」是由點分隔的兩個7位數字。我怎麼能讓發件人的名字變成別的東西,比如[email protected]

由於提前,

約翰

$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 
} 
+0

多個副本。其中包括:[如何更改默認郵寄地址在PHP郵件()](http://stackoverflow.com/questions/2908058/how-to-change-default-mailed-by-address-in-php-mail ) – 2010-09-14 06:00:58

回答

3

只需添加FROM:因此您的代碼將是這樣的:

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