在最短的时间内同时向大量用户发送邮件

时间:2015-10-16 07:18:45

标签: php

如果我想在存储在我的数据库中的同时向成千上万的用户发送邮件通知,使用简单的数据库查询来获取必须发送邮件的所需用户,然后同时向所有用户发送邮件将占用很多时候,那么在最短的时间内最好的方法是什么呢?

1 个答案:

答案 0 :(得分:0)

    This Solution may help you....

    (1) SET A Cron JOB For Sending E-Mail & Also Maintain a Flag For Those Persons which have you sent the mail. 
    (2) Also Use Ajax API Whicxh will Notify you regarding sent E-mails.

    (3)Steps :  How To Run PHP Script For Using Cron JOB

    Method 1: Execute the script using php from the crontab
    To execute myscript.php every 1 hour do the following:
    # crontab -e
    00 * * * * /usr/local/bin/php /home/john/myscript.php

    Method 2: Run the php script using URL from the crontab

    00 * * * * lynx -dump http://www.thegeekstuff.com/myscript.php

    The following script executes the php script (every 5 minutes) by calling the URL using CURL. Curl by default displays the output in the standard output. Using the “curl -o” option, you can also dump the output of your script to a temporary file as shown below.

    */5 * * * * /usr/bin/curl -o temp.txt http://www.thegeekstuff.com/myscript.php

Now You Can Implement Your Code Easily...