我对此脚本有疑问
<?php
$to = 'email@gmail.com';
$subject = $_POST['subject'];
$message = $_POST['message'];
$email = $_POST['email'];
$headers = 'From: '. $email . "\r\n" .
'Reply-To: email2@exaple.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
脚本发送电子邮件但我无法看到收件人。 $ email变量存在问题。如果我使用<?php echo $email ?>
,我可以看到它。
有表格
<form method="post" action="mail.php">
(...)
<div class="col-md-4">
<div class="form-group">
<input type="email" name="email" id="inputEmail" class="form-control" placeholder="Email" required="required">
<p class="help-block text-danger"></p>
</div>
</div>