为什么用户的电子邮件未在gmail上显示给我?它显示的是永远的123.lifetime.hosting电子邮件,而不是用户的

时间:2019-10-17 19:03:14

标签: php email

我不想永远这样...相反,我希望它向我显示用户的gmail ID。

enter image description here

它显示的是永远的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);
}
}
?>

1 个答案:

答案 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);
}
}
?>