douchuo9476 2014-07-26 15:17
浏览 45
已采纳

电子邮件确认“来自”字段无效

The following is code on my site for sending a confirmation email when the user signs up. The email gets sent just fine but the sender is blank (it comes up as "unknown sender"). I would like it to come from my email, from ABC Technologies.

{
// ---------------- SEND MAIL FORM ----------------
// send e-mail to ...
$to=$user;
// Your subject
$subject="Your confirmation link here";

// From
$header="from: ABC Technologies";
// Your message
$message="Confirmation link for college match site
";
$message.="Click on this link to activate your account 
";
$message.="http://$_SERVER[HTTP_HOST]/chat_site/confirmation.php?passkey=$confirm_code";
// send email
$sentmail = mail($to,$subject,$message,$header, "-f ABC Technologies");
}
  • 写回答

2条回答 默认 最新

  • dsjmrpym220113739 2014-07-26 15:36
    关注

    Correct, this is not a valid sender:

    $header="from: ABC Technologies";
    

    You're obviously missing the email address:

    $header="from: ABC Technologies <abc@example.com>";
    

    Additionally, this is not a valid return path:

    "-f ABC Technologies"
    

    Now you need an email address; not even an email+name combination, just an email:

    "-fabc@example.com"
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)