gpt4 book ai didi

php - 设置电子邮件的 "name"的 "sender"

转载 作者:行者123 更新时间:2023-11-29 02:07:20 24 4
gpt4 key购买 nike

如果对满足特定条件(subcheck = 1)的提交进行评论,下面的代码应该会发送一封电子邮件。它运行良好。

但是,显示的发件人“姓名”是两个由点分隔的 7 位数字。我怎样才能将发件人的姓名改成其他名称,例如 no-reply@domain.com?

提前致谢

约翰

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

最佳答案

只需添加 FROM:,这样您的代码将如下所示:

mail($mailaddress, "Someone has commented on your submission 
$submission.", $comment, "FROM: no-reply@domain.com");

关于php - 设置电子邮件的 "name"的 "sender",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3706418/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com