通过MySql发送电子邮件 [英] Sending E-mails through MySql

查看:117
本文介绍了通过MySql发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张桌子,我可以输入学生的详细信息。

每当我们在此表中插入一行时,都应该向学生发送一封邮件,让学生验证输入的详细信息。 />
电子邮件ID已经存储在表中了。

如何使用mysql实现这个?

I have a table where i enter the students details.
Whenever we insert a row in this table, a mail should be sent to the student for the student to verify the details entered.
The email id is already stored in the table.
How to implement this using mysql?

展开 | 选择 | Wrap | 行号

推荐答案

电子邮件是通过用于插入表格的服务器语言(例如PHP)发送的,而不是通过MySQL发送的。

既然你在插入新行时有电子邮件详细信息,你可以很容易地构建一个电子邮件消息并从你的插入到MySQL脚本中发送它。


Ronald
Email is sent via the server language used to insert the table (such as PHP), not by MySQL.
Since you have the email details at the time you insert the new row, you can easily construct an email message and sent it from your insert-into-MySQL script.

Ronald



电子邮件是通过用于插入表格的服务器语言(例如PHP)发送的,而不是通过MySQL发送的。

由于您在插入新行时有电子邮件详细信息,你可以轻松地构建一个电子邮件消息,并从你的插入到MySQL脚本中发送它。


Ronald
Email is sent via the server language used to insert the table (such as PHP), not by MySQL.
Since you have the email details at the time you insert the new row, you can easily construct an email message and sent it from your insert-into-MySQL script.

Ronald



你可以吗?为我提供更多细节!!

Can u provide me more details on this!!


您好praveena,


有两种方法可以满足您的需求。


第一种方式是以编程方式 - 即您在网站上有一个部分,用户可以在其中输入详细信息并注册。这个注册脚本使用PHP,ASP或您正在使用的任何服务器端语言将用户的信息保存到数据库中。

ronverdonk建议添加一些额外的代码到这个注册脚本会自动将电子邮件发送给新用户(除非您计划使用后端应用程序手动将用户添加到数据库中,否则这是有道理的。)


另一种方法是使用MySQL的SELECT ... INTO OUTFILE功能。

我最近创建了自己的用户数据库,并希望在他们注册验证电子邮件地址时向他们发送自动电子邮件。

我设计了一个触发器:
Hi praveena,

There are two ways of doing what you are asking for.

The first way is programatically - i.e. you have a section on your website where the user puts in their details and signs up. This sign-up script saves the user''s information into the database using PHP, ASP or whatever server-side language you are using.
What ronverdonk is suggesting is adding a few extra bits of code into this sign-up script that automatically sends the email to the new user (which makes sense unless you are planning on adding users manually to your database using a back-end application).

The other way is by using MySQL''s SELECT... INTO OUTFILE functionality.
I recently created my own user database and wanted to send automated emails to them when they signed up to verify their email address.
I worked out a trigger that:
  1. 捕获新用户的详细信息(电子邮件,名称和新的唯一ID以验证电子邮件);
  2. 从我的数据库中的表中检索HTML模板;
  3. 将用户的详细信息替换为该模板;
  4. 输出生成的HTML作为.eml使用INTO OUTFILE SQL将文件存入我的邮件服务器的提取文件夹,然后自动发送!

我稍后会提出我的触发器代码,因为我没有它目前,但我希望这有助于解决您的问题。


祝您好运,


medicineworker

I will put up my trigger code a little later on as I don''t have it to hand at present, but I hope that this helps towards your problem.

Best regards,

medicineworker


这篇关于通过MySql发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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