简体   繁体   English

用php发送带有多个附件的邮件

[英]sending mail with multiple attachment in php

I have this form to send email with 6 attachments. 我有这张表格发送带有6个附件的电子邮件。 I need help to code the php processing script to send multiple attachment . 我需要帮助编码php处理脚本以发送多个附件。 I will be glad if I can get hints on how to write the processing script to send email with multiple attachment in 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>

You could use <input type='file' name='file[]' multiple> to upload multiple files. 您可以使用<input type='file' name='file[]' multiple>上传多个文件。 Take a look at this tutorial. 看一下教程。 It should help! 应该有帮助!

I'd look into using PHPMailer . 我会考虑使用PHPMailer You'll be about to attach files easily with $mail->AddAttachment($path); 您将使用$mail->AddAttachment($path);轻松附加文件$mail->AddAttachment($path);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM