0

我有这个表格可以发送带有 6 个附件的电子邮件。我需要帮助编写 php 处理脚本以发送多个附件。如果我能得到有关如何编写处理脚本以在 php 中发送带有多个附件的电子邮件的提示,我将很高兴。

<<html>
<head>
<title>Send an Email</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>Send an Email</h1>
<form action="mail.php" method="POST" enctype="multipart/form-data">
<p>&nbsp;</p>
<table width="579" border="0">
<tr>
<td wid th="61">Email From:</td>
<td colspan="3"><input name="emailfrom" type="text" value="" size="90" /></td>
</tr>
<tr>
<td>Emai  To: </td>
<td colspan="3"><label for="emailto"></label>
  <textarea name="emailto" id="emailto" cols="70" rows="3"></textarea></td>
 </tr>
<tr>
<td valign="middle">Subject::</td>
<td colspan="3"><input name="subject" type="text" value="" size="90" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td>Message:</td>
<td colspan="3"><textarea cols="70" rows="18" name="message"></textarea></td>
</tr>
<tr>
<td nowrap>Attach file</td>
<td width="224"><input name="file1" type="file" class="send" size="24" /></td>
<td width="61" nowrap>Attach file</td>
<td width="218"><input name="file2" type="file" size="24" /></td>
 </tr>
<tr>
<td nowrap>Attach file</td>
<td><input name="fil3" type="file" class="send" size="24" /></td>
<td nowrap>Attach file</td>
<td><input name="file4" type="file" size="24" /></td>
 </tr>
<tr>
<td nowrap>Attach file</td>
<td><input name="file5" type="file" class="send" size="24" /></td>
<td nowrap>Attach file</td>
<td><input name="file6" type="file" size="24" /></td>
</tr>
<tr>
<td nowrap>&nbsp;</td>
<td>&nbsp;</td>
<td nowrap>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td nowrap>&nbsp;</td>
<td>&nbsp;</td>
<td nowrap>&nbsp;</td>
<td align="right"><input type="submit" class="send" value="Send" /></td>
 </tr>
</table>

</form>

4

1 回答 1

0

您可以使用<input type='file' name='file[]' multiple>上传多个文件。看看这个教程。它应该有帮助!

我会考虑使用PHPMailer。您将要轻松附加文件$mail->AddAttachment($path);

于 2012-12-11T20:25:52.920 回答