向此邮件表单添加附件
我有这个简单的 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 = '[email protected]';
$subject = 'Connect FORM <<';
$headers = 'From: [email protected]' . "\r\n" .
$message = $fulltext;
mail($to, $subject, $message, $headers);
echo 'file ersal shod';
?>
I have this simple php mail form. It is working and I can use it for making my forms, but I have a problem:
I want to add 2 or 3 attachments to this form. I tried a lot reading about mail at php.net
, but I cannot do it by my self.
<?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 = '[email protected]';
$subject = 'Connect FORM <<';
$headers = 'From: [email protected]' . "\r\n" .
$message = $fulltext;
mail($to, $subject, $message, $headers);
echo 'file ersal shod';
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我改进了 http://ru.php.net/manual/ru 的代码/function.mail.php#105661 :
I improved code from http://ru.php.net/manual/ru/function.mail.php#105661 :