在 php 中安排电子邮件 [英] schedule an email in php

查看:26
本文介绍了在 php 中安排电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想安排从 php 脚本发送电子邮件.我希望用户指定日期和时间,然后在指定的日期和时间,我希望自动发送这些电子邮件.我该如何实施?我正在研究 codeigniter.

I want to schedule sending of email from php script. I want user to specify date and time and then on the specified date and time, I want those emails to be sent automatically. How do I implement it? I am working on codeigniter.

推荐答案

一种方法是创建scheduled_emails"数据库表.将您要排队的所有电子邮件放入其中,包括收件人、主题、消息和可选标题等列.

One way to do it would be to create a "scheduled_emails" database table. Put all the emails you want to queue in there, including columns such as, recipient, subject, message and optional headers.

然后您可以设置一个脚本来查看该表并发送任何send_time"大于当前时间的电子邮件.然后,您可以设置一个 cron 作业来每 .. 5 分钟运行一次该脚本.

You could then set up a script to look at that table and send any emails that have a "send_time" which is greater than the current time. You could then set up a cron job to run this script every.. 5 minutes for example.

这篇关于在 php 中安排电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆