Php, mysql,是否可以在插入一行并上传文档后自动发送电子邮件到相关客户端


php, mysql, is it posible after inserting a row and uploading doc automatical send email to releted client

例如,下面是一个客户列表表:

tbl_client:
    cl_name:    //primary auto
    cl_email:   //unique

现在有一个表,我将在其中插入数据:

tbl_data
    d_id:
    d_title
    d_file    // this will be file and uploaded
    cl_name

如您在(tbl_data)表中看到的,有一个列名(cl_name)被引用到tbl_client

现在,如果我插入新的记录到表tbl_data并上传文件,例如

d_id   d_title   d_file   u_name
1      text      f1.pdf    client1

这个想法是系统应该发送一个电子邮件给client1自动附加文件。

是否可以使用PHP或其他解决方案。

感谢您耐心地阅读我的问题

您可以检查数据库上的查询是否成功,然后使用php发送邮件。

if(mysqli_query($link, $querygoeshere))
{
    //Mail function here.
    mail():
}else
{
    //Error handling goes here.
}

当然,你可以在php.net

上查看各种mysqli_* stuff和mail函数的文档。