0

I can't get the syntax quite right with PHP. How do I change it to display the sender's full name as well as their email address in the 'From:' part this PHP email script?

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= "From: " . $_REQUEST['email'] . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$message .= 'Name: ' . $_REQUEST['name'] . "<br>";
$message .= $_REQUEST['message'];

I tried

$headers .= "From: " . $_REQUEST['email'] '<'$_REQUEST['name']'>'. "\r\n";

But I've screwed up the code somewhere.

Thanks guys!

4

1 回答 1

0

邮件标头是这样的,Person Name <email@example.com>因此您的标头必须是:

$headers .= "From: $_REQUEST[email] <$_REQUEST[name]>\r\n";
于 2013-07-01T20:55:31.780 回答