如何自动将csv文件从服务器导出到电子邮件作为附件 [英] How do I automatically export a csv file from server to email as attachment

查看:133
本文介绍了如何自动将csv文件从服务器导出到电子邮件作为附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一篇文章或书籍,告诉我(使用php代码)如何将我创建并存储在我的主机服务器上的CSV文件导出到我的电子邮件中的附件。



我已经成功(使用Apache和PHP在localhost上测试)使用Html5 / css3 / javascript / php7代码编写了一个应用程序,它从表单中获取数据(16个字段)并将其发送到服务器并将其保存到服务器上的CSV文件中。现在,我希望每次客户填写并提交表单时,都会将CSV文件作为电子邮件附件接收。



我尝试过:



到目前为止我能找到的所有文章都是将数据发送到CSV文件,而不是从服务器上的CSV文件发送。

I am looking for an article or book that would show me (using php code) how to export a CSV file that I have created and stored on my host server to an attachment on my email.

I have "successfully" (tested on localhost using Apache and PHP) written using Html5/css3/javascript/php7 code an application that takes data (16 fields) from a form and sends it to the server and saves it into a CSV file on the server. Now I want to receive that CSV file as an email attachment each time a client fills in and submits the form.

What I have tried:

All of the articles that I can find so far are sending data TO a CSV file not FROM a CSV file on the server.

推荐答案

在发送之前,您需要使用PHP邮件生成电子邮件并将文件附加到邮件中。请参阅 PHP:mail - Manual [ ^ ]
You would need to use PHP mail to generate the email and attach the file to the message before sending. See PHP: mail - Manual[^]


这篇关于如何自动将csv文件从服务器导出到电子邮件作为附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆