mysql发送邮件代码,通过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?

Expand|Select|Wrap|Line Numbers

解决方案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

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!!

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:Captured the new user''s details (email, name and new Unique ID to verify email);

Retrieved an HTML template from a table in my database;

Substituted the user''s details into that template;

Outputted the resulting HTML as a ".eml" file into my mail server''s pickup folder, using INTO OUTFILE SQL, and it got sent automatically!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

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

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

电子邮件ID已经存储在表中了。

如何使用mysql实现这个?

展开 | 选择 | Wrap | 行号

解决方案

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

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

Ronald

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

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

Ronald

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

您好praveena,

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

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

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

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

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

我设计了一个触发器:捕获新用户的详细信息(电子邮件,名称和新的唯一ID以验证电子邮件);

从我的数据库中的表中检索HTML模板;

将用户的详细信息替换为该模板;

输出生成的HTML作为".eml"使用INTO OUTFILE SQL将文件存入我的邮件服务器的提取文件夹,然后自动发送!我稍后会提出我的触发器代码,因为我没有它目前,但我希望这有助于解决您的问题。

祝您好运,

medicineworker

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值