Email 向此邮件表单添加附件

Email 向此邮件表单添加附件,email,attachment,php,Email,Attachment,Php,我有这个简单的php邮件表单。它正在工作,我可以用它制作表格,但我有一个问题: 我想在此表单中添加2或3个附件。我在php.net上读了很多关于邮件的书,但我自己做不到 <?php $name=$_POST['name']; $email=$_POST['email']; $address=$_POST['address']; $phone=$_POST['phone']; $fax=$_POST['fax']; $mobile=$_POST['mobile']; $subject=$_P

我有这个简单的php邮件表单。它正在工作,我可以用它制作表格,但我有一个问题:

我想在此表单中添加2或3个附件。我在php.net上读了很多关于邮件的书,但我自己做不到

<?php
$name=$_POST['name'];
$email=$_POST['email'];
$address=$_POST['address'];
$phone=$_POST['phone'];
$fax=$_POST['fax'];
$mobile=$_POST['mobile'];
$subject=$_POST['subject'];
$website=$_POST['website'];
$message=$_POST['message'];
$fulltext = "
______________________________________________
| 
| This Is $name Information: 
|______________________________________________
| Name : $name
|______________________________________________
| E-Mail : $email
|______________________________________________
| Address : $address
|______________________________________________
| Phone : $phone
|______________________________________________
| FAX : $fax
|______________________________________________
| Mobile : $mobile
|______________________________________________
| Subject : $subject
|______________________________________________
| Website : $website
|______________________________________________
| Message : $message
|______________________________________________ 
";
$to = 'support@site.com';
$subject = 'Connect FORM <<';
$headers = 'From: contactform@site.com' . "\r\n" .
$message = $fulltext;

mail($to, $subject, $message, $headers);
echo 'file ersal shod';
?>
我从以下方面改进了代码:

在您的代码中使用multi_attach_mail而不是steed mail函数,就像这样$message=$fulltext;多附件邮件$to、$subject、$message、数组'/path/to/file1.ext'、'/other/path/file2.ext'、'some@email.com'; 回声“文件旧鞋”;