从 mySQL 存储过程发送电子邮件
我可以在 mySQL 中编写一个存储过程(或一个简单的查询)来发送包含查询结果的电子邮件吗?
任何帮助都会有用的。
Can I write a Stored Procedure (or a simple query) in mySQL which can send an email out containing results of a query.
Any help will be useful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
并非没有修改。它根本没有与电子邮件相关的功能。你可以为它编写一个自定义模块来添加这样的功能,但在我看来,类似的事情是在使用 MySQL 的应用程序的权限内,而不是 MySQL 本身。
Not without modifications. It has no email-related functions at all. You could write a custom module for it to add such a function, but it seems to me that something like that is in the purview of the application using MySQL, not MySQL itself.
不是直接在 MySQL 中,但我周末做了类似的事情。
背景:我在周末编写了一个应用程序来学习 PHP。我知道我必须从 MySQL 数据库通过电子邮件发送信息,因此我需要一种使用 PHP 轻松发送电子邮件的方法,因此我集成了 PostageApp 进入我的应用程序,花费了不到 15 分钟。
相关:我编写了一个脚本来提取 MySQL 中的特定行,并使用
mysql_fetch_array()
来访问行中每个字段的信息。对于该数组,我只是将变量传递到 PostageApp API 调用中,该调用使用了一个包含这些变量占位符的模板。 PostageApp 为我完成了剩下的工作。这是我在 PostageApp 中的模板的样子:
当然,不完全是这样,但这些是变量,然后传递到 API 调用中。
如果我可以帮助您,请告诉我。
(全面披露:我是 PostageApp 的产品经理。但实际上我确实在周末构建了一个应用程序作为业余项目。)
Not directly in MySQL, but I worked on something similar over the weekend.
Background: I wrote an app over the weekend to learn PHP. I knew I would have to be emailing out information from a MySQL database, so I needed a way to send emails with PHP easily, so I integrated PostageApp into my app, which took less than 15 minutes.
Relevant: I wrote a script to pull specific rows in MySQL, and used
mysql_fetch_array()
to be able to access the information for each of the fields in a row. With the array, I just passed the variables into a PostageApp API call, which used a template that had placeholders for these variables. PostageApp did the rest for me.Here's how my template in PostageApp looked like:
Of course, not exactly what it is, but those are the variables, that were then passed into the API call.
Let me know if I can help you out with that.
(Full Disclosure: I am the Product Manager of PostageApp. But I actually did build an app over the weekend as a side project.)