0

我知道这可能是一个非常简单的问题,我已经通过谷歌在这里和其他地方搜索了答案,但似乎仍然无法让它工作。这就是问题所在。我有以下代码:

$name = $_POST['Name'];
$phone = filter_var($_POST['Phone'], FILTER_SANITIZE_NUMBER_INT);
$address = $_POST['Address'];
$city = $_POST['City'];
$contact_time = $_POST['Call-Time'];
$job_descr = $_POST['Job-Description'];
$subject= $name. ' requested a quote';
$text = $name. " just requested a quote.\r\n";

foreach($_POST as $item => $key)// Get all of the variables sent and put them in a list
to be emailed
{   
    if(!empty($key) and $item != 'submit')
        $textappend .= "$item: $key\r\n";
}

$text .= "Information:\r\n$textappend";

电子邮件收集所有变量并发送它们。唯一的问题是它不会输出代码中 \r\n 所在的新行。它只是在一行中显示所有内容。我没有使用带双引号的正确引号吗?任何帮助将不胜感激。谢谢

4

1 回答 1

1
$headers .= "\n--$boundary\n"; // beginning \n added to separate previous content
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";

$headers变量传递给 mail 函数,让我知道它是否有效

于 2012-06-04T23:58:51.600 回答