PHP 中的电子邮件附件?

发布于 2024-09-16 02:19:47 字数 643 浏览 2 评论 0原文

我有一个带有“文件”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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

骑趴 2024-09-23 02:19:47

是的,您需要先将文件上传到服务器。

使用 Swiftmailer 等邮件类发送文件。

Yes, you will need to upload the file to the server first.

Use a mailing class like Swiftmailer to send the file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文