doumengjing1500 2015-04-26 18:51
浏览 41
已采纳

PHP发送邮件显示名称而不是电子邮件[重复]

This question already has an answer here:

//send email

        $to = $_POST['email'];

        $subject = "Welcome!";

        $body = "Contains sensitive information that activates users so I've removed it.";

        $additionalheaders = "From: <".SITEEMAIL.">
";

        $additionalheaders .= "Reply-To: ".SITEEMAIL."";

        mail($to, $subject, $body, $additionalheaders);

Basically the above code successfully sends an email, and in the inbox it displays as noreply@mydomain which is fine, but I've noticed that other sites show actual names. Like messages from Facebook say Facebook not noreply@facebook.com. Is there a header I am missing to accomplish this?

EDITED TO SHOW ANSWER:

//send email

        $to = $_POST['email'];

        $subject = "Welcome!";

        $body = "Contains sensitive information that activates users so I've removed it.";

        $additionalheaders = "From: Name <".SITEEMAIL.">
";

        $additionalheaders .= "Reply-To: ".SITEEMAIL."";

        mail($to, $subject, $body, $additionalheaders);
</div>
  • 写回答

1条回答 默认 最新

  • douque9982 2015-04-26 18:54
    关注
    from: Jon Jones <Jon@Jones.com>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?