PHP MySQL - 插入数据时接收邮件

时间:2022-09-25 16:08:45

Is it possible to receive and e-mail every time a customer, user, etc. fills in a form which is being inserted into tables on a MySQL Database?

每次客户,用户等填写插入MySQL数据库表格的表格时,是否可以接收和发送电子邮件?

Thanks!

3 个解决方案

#1


2  

Yes certainly, check out the mail() function:

是的,请查看mail()函数:

http://php.net/manual/en/function.mail.php

#2


0  

Yes. In the script that handles the form, eg, <form method = "post" action = "someScript.php"> in "someScript.php", you can use the mail function, which is easy enough as long as the e-mail isnt very complicated. You will have to watch out for header injection attacks.

是。在处理表单的脚本中,例如,“someScript.php”中的

,您可以使用mail函数,只要电子邮件很容易不是很复杂。您将不得不注意标头注入攻击。

An alternative, and almost imperative if your understanding isn't that great, is to use an external PHP Library to handle sending the mail for you. There's many out there, but this thread and this thread have links to a couple.

如果您的理解不是很好,那么另一种方法是使用外部PHP库来处理为您发送邮件。有很多,但这个线程和这个线程有一对夫妇的链接。

#3


0  

Right after your query you could simply call PHP's mail() function

在查询之后,您可以简单地调用PHP的mail()函数

A couple of links to get you started:

一些可以帮助您入门的链接:

#1


2  

Yes certainly, check out the mail() function:

是的,请查看mail()函数:

http://php.net/manual/en/function.mail.php

#2


0  

Yes. In the script that handles the form, eg, <form method = "post" action = "someScript.php"> in "someScript.php", you can use the mail function, which is easy enough as long as the e-mail isnt very complicated. You will have to watch out for header injection attacks.

是。在处理表单的脚本中,例如,“someScript.php”中的

,您可以使用mail函数,只要电子邮件很容易不是很复杂。您将不得不注意标头注入攻击。

An alternative, and almost imperative if your understanding isn't that great, is to use an external PHP Library to handle sending the mail for you. There's many out there, but this thread and this thread have links to a couple.

如果您的理解不是很好,那么另一种方法是使用外部PHP库来处理为您发送邮件。有很多,但这个线程和这个线程有一对夫妇的链接。

#3


0  

Right after your query you could simply call PHP's mail() function

在查询之后,您可以简单地调用PHP的mail()函数

A couple of links to get you started:

一些可以帮助您入门的链接: