首页 > 解决方案 > 在 Headers From 字段中使用 Php 变量

问题描述

我正在尝试设置一个 PHP 邮件程序。由于某些未知原因,我不能在 From 字段上使用变量

$headers = "MIME-Version: 1.0\r\n";
$headers .= "From: Blaine<{$from_email}>\r\n";
$headers .= "Reply-To: " . $from_email . "" . "\r\n";
$headers .= "Content-Type: multipart/mixed; 
boundary = $boundary\r\n\r\n";

而不是布莱恩,我想使用我之前设置的变量,但是当我这样做时,我试图设置一个 PHP 邮件程序。由于某些未知原因,我不能在 From 字段上使用变量

$headers .= "From: .$var <{$from_email}>\r\n";

我不知道发件人姓名

标签: php

解决方案


$headers .= "From: $senderName <$senderEmail>\r\n";

推荐阅读