douchanxiu5636 2011-09-10 13:08
浏览 82

自动从数据库发送电子邮件

Is it possible to send a automatic mail from database depending on the date? When date is equal to some Particular date , emain should go to the user.

I have created my database table in mysql like this:

create table tb1(name varchar(20), email varchar(30), date varchar(10));

I will be using php. Please suggest me how to do it?

  • 写回答

3条回答 默认 最新

  • duanchui1279 2011-09-10 13:27
    关注

    Traditional approach:
    Depends on OS you can set up a scheduled task(cron job) that runs with a certain interval (I think it doesn't have to be very accurate, 3-5 minutes seems ok to me), grabs expired rows from the table, send emails and mark the records (I suggest adding email_status column ) based on delivery status (success, failure, bounced, etc). You might want to add another column for storing mail server response.

    Another option is more complex. You can write a native UDF that is capable of sending emails. Then you create recurring event that calls this function . It can be a good exercise, but may not be the best solution. Pros : completely done on server side, no client code required. Cons: creating and debugging native function can be a challenge, the function has to be uploaded to server instance, logic resides on database server

    评论

报告相同问题?

悬赏问题

  • ¥15 高缺失率数据如何选择填充方式
  • ¥50 potsgresql15备份问题
  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!