我已经制作了一个通过 php 注册的表单。该表单具有提交者电子邮件地址字段。我希望在表单提交后,表单内容将通过提交者电子邮件地址和管理员电子邮件地址发送给表单提交者和管理员。提交者电子邮件地址将从提交者电子邮件地址字段中获取。管理员电子邮件地址是固定的。对于 Submitter headers="from : no-reply@eschool.com" messagebody 与它相同
对于 admin headers=" from :$email" messagebody 与它相同
我试图这样做:
html代码:
<form action="action.php" method="post">
<table>
<tr>
<td>Name</td>
<td>:</td>
<td><input type="text" name="name" width="400" /></td>
</tr>
<tr>
<td>Address</td>
<td>:</td>
<td><input type="text" name="address" width="400" /></td>
</tr>
<tr>
<td>Email</td>
<td>:</td>
<td><input type="text" name="email" width="400" /></td>
</tr>
<tr>
<td>Password</td>
<td rowspan="2"> </td>
<td>
<p><input type="text" name="pass" width="400" /></p>
<p> </p>
</td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="insert" value="Insert" /></td>
</tr>
</table>
<input type="submit" value="submit" />
</form>
动作.php
$name = $_POST["name"];
$address = $_POST["address"];
$email = $_POST["email"];
$password = $_POST['pass'];
$subject = "Thank you for your registration.";
$admin = "info@editor.com";
$to = $email . "," . $admin;
$email_message .= "Name: ". $name."\n";
$email_message .= "Address: ".$address."\n";
$email_message .= "Email: ".$email."\n";
$email_message .= "password: ".$password."\n";
$headers = "MIME-Version: 1.0" . "\n";
$headers .= "Content-type:text/plain;charset=UTF-8;" . "\n";
$headers .= "content-Transfer-encoding: 8bit" ."\n";
$headers .= "From: no-reply@eschool.com ". "\n";
mail($to, $subject, $email_message, $headers);
谢谢