使用 php 将文件附加到电子邮件 [英] attach file to email using php
本文介绍了使用 php 将文件附加到电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的表单上有一个输入,允许用户浏览到文件位置.这个想法是他们可以将简历附加到他们准备提交的申请中.
I have an input on my form to allow a user to browse to a file location. The idea being that they can attach a resume to to the application they are getting ready to submit.
<label class="description" for="element_5">Upload a File </label>
<div>
<input id="element_5" name="element_5" class="element file" type="file"/>
对于我的文本字段和下拉列表,我一直在使用以下内容:
For my text feilds and dropdowns I have been using something along the lines of:
$experince = $_POST["experince"];
但我不想要路径字符串,我想要实际文件.如何获取文件本身以及如何将其附加到电子邮件中?
But I don't want the path string i want the actual file. How do I get the file itself and how do I attach it to the email?
另外,是否有一种简单的方法可以将附件限制为 .DOC/.PDF?
Also, is there a easy way to limit the attachment to .DOC / .PDF?
推荐答案
看一看
- http://docs.php.net/features.file-upload对于脚本的(文件)上传部分
- http://swiftmailer.org/docs/message-attachments 用于发送电子邮件附件
- http://docs.php.net/features.file-upload for the (file) upload part of the script
- http://swiftmailer.org/docs/message-attachments for sending emails with attachments
这篇关于使用 php 将文件附加到电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文