PHP 中的电子邮件附件?
我有一个带有“文件”html 输入字段和“提交”按钮的页面,如下所示:
<form id="formUploadfile" name="formUploadfile" method="post" action="" class="form" enctype="multipart/form-data">
<label for="name"><strong>File</strong></label>
<input type="file" name="uploaded_file" size="35" />
<button type="submit" class="btn_common" id="inquiry_submit" name="inquiry_submit">
Submit
</button>
</form>
我想将所选文件发送到预定义的电子邮件地址。在 PHP 中,我是否需要先将文件上传到我的服务器,然后再将其作为附件发送?或者不上传到服务器,它也可以工作。
我用谷歌搜索但没有找到上述问题的答案,请帮忙。如果有人有相同目的的代码,请提供链接。
谢谢
I have a page with "File" html input field and a "Submit" button as below:
<form id="formUploadfile" name="formUploadfile" method="post" action="" class="form" enctype="multipart/form-data">
<label for="name"><strong>File</strong></label>
<input type="file" name="uploaded_file" size="35" />
<button type="submit" class="btn_common" id="inquiry_submit" name="inquiry_submit">
Submit
</button>
</form>
I want to send the selected file to a pre-defined email address. In PHP, Do I need to upload the file to my server first before sending it as an attachment email? Or without uploading it to server, it will work.
I Googled but didn't find the answer of above question, please help. If anyone have a code for the same purpose, please provide link.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您需要先将文件上传到服务器。
使用 Swiftmailer 等邮件类发送文件。
Yes, you will need to upload the file to the server first.
Use a mailing class like Swiftmailer to send the file.