如何通过cron工作发送电子邮件usng PHP mysql [英] How to send emails via cron job usng PHP mysql

查看:251
本文介绍了如何通过cron工作发送电子邮件usng PHP mysql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设法发送了多封电子邮件(请点击这里).i我坚持通过cron发送自动电子邮件。

i managed to send multiple emails (check here).i am stuck with sending automated emails via cron.

这是我需要的 - 当管理员发送电子邮件时,我将消息,电子邮件,事件日期存储在数据库中。现在我试图设置一个cron作业,发送电子邮件到所有这些ids从表中的消息我有一个提醒。我不熟悉cron工作脚本,任何人都可以帮助指导我正确的方式写脚本,我可以放在cron选项卡。我计划发送两封邮件 - 事件前一天和event.thanks的日期

This is what i need - while the admin send emails, i store the message, emails, event date in the database. now i am trying to set a cron job to send emails to all these ids from the table with the message i have as a reminder. i am not familiar with cron job scripting, can anyone help in guiding me the right way to write script that i can place in cron tab. I am planning to send two mails - one day exactly before the event and on the day of event.thanks

推荐答案

正常的PHP脚本 - 使一个将工作,如果它是直接从浏览器启动。然后安排在cron中运行非常相同的PHP文件,使用此指南:

Just write a normal PHP script -- make one that will work if it's launched directly from the browser. Then schedule that very same PHP file to run in cron, using this as a guide:

http://www.unixgeeks.org/security/newbie/unix/cron-1.html

基本上,使用开头的值,指定计划(分钟,小时,星期几,日期等)。然后设置它运行的用户,这可能是apache或任何web服务器守护程序正在运行。然后将cron运行的命令设置为 php php_email_script.php (其中php_email_script.php是您的PHP文件的名称。

Basically, using the values at the beginning, specify the schedule (minute, hour, day of week, day of month, etc.). Then set the user it runs as, which is likely to be "apache" or whatever your web server daemon is running under. Then set the "command" that cron is running to be php php_email_script.php (where "php_email_script.php" is the name of your PHP file.

这篇关于如何通过cron工作发送电子邮件usng PHP mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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