php群发邮件和提醒

发布于 2024-09-09 10:21:35 字数 171 浏览 2 评论 0原文

我正在一个有管理员的网站上工作,我想看看如何允许管理员发送大量电子邮件来通知他正在组织的活动,一旦他第一次邀请,然后在活动日期期间, cron 作业应该自动向作者发送他第一次使用的电子邮件 ID 的提醒。就像 evite 所做的那样。想要了解这些功能,如果可能的话,如果活动被取消或推迟,如何发送电子邮件。

问候

I am working on a site where I have the admin manager and i am trying to see how can I allow the admin to send mass emails to notify the event he is organizing, once he invites for the first time then towards during the event date, cron job should automatically send reminder to the author the email id's he used first time. something like how evite does. would like to learn these functionalities and also if possible how to send email if the event is canceled or postponed.

regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

老娘不死你永远是小三 2024-09-16 10:21:35

实现此目的的一种方法是拥有一个 OutgoingEmail 表,并在该表中存储电子邮件应发出的日期/时间、电子邮件地址、主题和正文。

组织活动后,生成电子邮件内容并为每个与会者插入包含当前日期/时间的记录。如果管理员选择外出提醒,也请插入带有未来日期/时间的电子邮件。当事件发生变化时,清除该事件的任何待处理的外发电子邮件记录,并插入“事件已更改”电子邮件的记录(如有必要,添加包含更新详细信息的新提醒电子邮件。)

创建将从以下位置运行的 PHP 脚本: crontab,并让它查询 OutgoingEmail 表中包含过去日期/时间的任何记录。使用 PHP mail() 函数循环遍历它们,并在成功发送它们后删除它们。

将其安排为每 10 分钟左右运行一次,并且您应该编写一个例程以确保一次仅运行一个实例。过去我创建了一个“锁定”文件,脚本开始时将检查锁定文件。如果锁定文件存在,则退出。如果不存在,请创建它,处理电子邮件,然后删除锁定文件。

您还有其他问题吗?

One way to do this would be to have an OutgoingEmail table, and in that table store the date/time that the email should go out, the email address, subject, and body.

When the event is organized, generate the contents of the email and insert a record for each attendee with the current date/time. If the admin selects for a reminder to go out, also insert those emails with that future date/time. When the event changes, clear out any pending outgoing email records for that event, and insert records for an 'event changed' email (and if necessary, add new reminder emails with the updated details.)

Create your PHP script that will run from the crontab, and have it query any records in the OutgoingEmail table with date/times in the past. Loop through them using the PHP mail() function and delete them as you send them successfully.

Schedule it to run every 10 minutes or so, and you should code a routine to ensure that only one instance is running at a time. In the past I have created a 'lock' file, and the start of the script would check for the lock file. If the lock file exists, quit. If it does not exist, create it, process emails, and then remove the lock file.

Do you have more questions?

世界如花海般美丽 2024-09-16 10:21:35

我会研究 PHP 邮件功能。他们还提供了可靠的示例,并且还可以在网上找到更多示例。使用服务器端的东西来跟踪运行脚本的日期

I would look into the PHP Mail functions. They also have solid examples and more can be found online as well. Use something server side to keep track of dates for when to run the scripts

兲鉂ぱ嘚淚 2024-09-16 10:21:35

我会使用这个类来发送电子邮件,我已经使用了很多年并且非常整洁。

http://sourceforge.net/projects/phpmailer/files/phpmailer%20for %20php5_6/

然后在表上运行查询,说明 14 天时间中的日期,并发送包含该类的电子邮件。确保突出显示表行并发送提醒,以防文件在第二天之前再次运行,如果人们收到多个提醒,他们会感到非常恼火。

I would use this class for sending emails, i have used for years and is very tidy.

http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/

then run a query on the table say where the date is in 14 days time and send an email with that class. Make sure you highlight the table rows with a reminder sent just in case that file gets run again before the next day, people will get really annoyed if they get more than one reminder.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文