从 mySQL 存储过程发送电子邮件

发布于 2024-10-17 01:13:25 字数 72 浏览 1 评论 0原文

我可以在 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 技术交流群。

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

发布评论

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

评论(2

浮生未歇 2024-10-24 01:13:25

并非没有修改。它根本没有与电子邮件相关的功能。你可以为它编写一个自定义模块来添加这样的功能,但在我看来,类似的事情是在使用 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.

愿与i 2024-10-24 01:13:25

不是直接在 MySQL 中,但我周末做了类似的事情。

背景:我在周末编写了一个应用程序来学习 PHP。我知道我必须从 MySQL 数据库通过电子邮件发送信息,因此我需要一种使用 PHP 轻松发送电子邮件的方法,因此我集成了 PostageApp 进入我的应用程序,花费了不到 15 分钟。

相关:我编写了一个脚本来提取 MySQL 中的特定行,并使用 mysql_fetch_array() 来访问行中每个字段的信息。对于该数组,我只是将变量传递到 PostageApp API 调用中,该调用使用了一个包含这些变量占位符的模板。 PostageApp 为我完成了剩下的工作。

这是我在 PostageApp 中的模板的样子:

Hey {{first_name}},

On {{date}}, we noted that you went to {{url}} for the first time.

当然,不完全是这样,但这些是变量,然后传递到 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:

Hey {{first_name}},

On {{date}}, we noted that you went to {{url}} for the first time.

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.)

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