dsizd368332 2014-02-21 16:19
浏览 55
已采纳

在php上创建自动发送电子邮件应用程序时的概念是什么?

I have an website running, and what I want to do is create a Table that has listed all the email that need to be sent, with all the information in it. Example:

CREATE TABLE Send_Email
ID INT,
To VARCHAR(130),
Subject VARCHAR(130),
Message TEXT

What I want to do - and don't know how - is to check automatically if there is any record on this table, if there is: Send the email(s) and delete the row(s).

What I don't know is what is the concept when building something like this. Where to put it? How to check it automatically? Do I put the loop code on my main "master controller" and run it every time someone loads up one of my pages? This looks like it will affect performance.

  • 写回答

1条回答 默认 最新

  • doudu2404 2014-02-21 16:24
    关注

    This is the ideal task for a cron job (or any equivalent system). You need a service running on your server, which will periodically perform your wanted action. If you have your own server, this can be done for sure, but if you have your site hosted somewhere you need to check with the provider for this possibility.

    EDIT: If you can't use scheduled jobs, it might still be reasonable to perform the action somewhere else. For example, if the records in the table are inserted only from within your website, you could configure it to forward an email as soon as it is sent by the writer, avoiding the need to regularly check the database (in fact, you wouldn't need a table at all). It is obvious though that this solution is not as flexible as the other one, and that it is applicable only in particular situations.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?