1

Possible Duplicate:
Creating an email queue in PHP?

My PHP script is sending hundreds of emails. And I want to set gap between these email sending times as 5 mins. I mean, time tap between each 2 emails should be 5 mins. Like one should be sent at 12:45am, second 12:50am and so on.

For that I have tried from command line:

at 08:10am Dec 19
echo "Welcome" | mail -s "Hello world" abc@abc.com

So this works fine, mail is sent at 08:10am. But, how can I do the same from PHP? How can I use AT command of linux from PHP?

Or there is any other easy way?

4

1 回答 1

1

要回答您的问题:

可以使用多种方法从 PHP 调用外部程序。其中之一是passthru()并为其提供与您手动编写的相同的完整命令字符串。

您可以为此使用的其他功能是:

popen() // Opens process file pointer
exec() // Execute an external program
system() // Execute an external program and display the output
passthru() //- Execute an external program and display raw output
pcntl_exec() // Executes specified program in current process space
`at` // backtick operator

作为一个附带问题:

电子邮件队列确实更适合这种情况 - usingat是您要完成的任务的简单技巧。

于 2012-12-19T07:28:40.643 回答