我不想永远这样...相反,我希望它向我显示用户的gmail ID。
它显示的是永远的123.lifetime.hosting电子邮件,而不是用户的电子邮件。这是什么问题,我该如何解决?
<?php
if( isset($_POST['name']) )
{
$to = 'businessbox101@gmail.com';
$subject = $_POST['subject'];
$message = $_POST['message'] . "\n\n" . 'Regards, ' . $_POST['name'] . '.';
$headers = 'From: ' . $_POST['name'] . "\r\n" . 'Reply-To: ' . $_POST['email'] . "\r\n" . 'X-Mailer:
PHP/' . phpversion();
mail($to, $subject, $message, $headers);
if( $_POST['copy'] == 'on' )
{
mail($_POST['email'], $subject, $message, $headers);
}
}
?>
答案 0 :(得分:-1)
这是假设表单上的电子邮件地址已保存到该帖子变量$_POST['email']
<?php
if( isset($_POST['name']) )
{
$to = 'businessbox101@gmail.com';
$subject = $_POST['subject'];
$message = $_POST['message'] . "\n\n" . 'Regards, ' . $_POST['name'] . '.';
$headers = 'From: ' . $_POST['email'] . "\r\n" . 'Reply-To: ' . $_POST['email'] . "\r\n" . 'X-Mailer:
PHP/' . phpversion();
mail($to, $subject, $message, $headers);
if( $_POST['copy'] == 'on' )
{
mail($to, $subject, $message, $headers);
}
}
?>