我在网站上使用简单的联系表单和脚本。我唯一的问题是,当我收到他们提交的内容时,我希望该人员的电子邮件填写用作回复电子邮件地址的表单,而不是我的服务器地址。这样我就可以简单地回复联系人而不必复制并粘贴他们的地址并开始回复电子邮件。
有任何简单的方法吗?
以下是我正在使用的简单代码。
<?php
header('Location: http://XXXXXXXXXXXXXXXXX/contact.html');
$name = $_REQUEST['Person'];
$company = $_REQUEST['company'];
$address = $_REQUEST['address'];
$city = $_REQUEST['city'];
$state = $_REQUEST['state'];
$zip = $_REQUEST['zip'];
$email = $_REQUEST['email'];
$phone = $_REQUEST['phone'];
$subject = $_REQUEST['subject'];
$details = $_REQUEST ['details'];
$byphone = $_REQUEST ['Phonebox'];
$emailbox = $_REQUEST['Emailbox'];
$message = "From $name\n Company $company\n Address $address\n $city $state $zip\n Email $email\n Phone $phone\n Subject $subject\n\n Details $details\n\n Contact by $byphone $emailbox";
mail ("XXXXXXXXX.com", "Customer Inquiry", "$message", "$email");
?>
答案 0 :(得分:0)
检查出来:http://php.net/manual/en/function.mail.php
(以下示例)
<?php
$to = 'server_owner@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: i_filled_the_form@example.com' . "\r\n" .
'Reply-To: i_filled_the_form@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>