Automatic Mail Sending on specific Dates in PHP

前端 未结 5 1562
春和景丽
春和景丽 2020-12-22 07:24

I am having some mail ids in my database. I have to send mail to those mail ids automatically on some specific dates that i have mentioned in my database.How to do that in p

5条回答
  •  -上瘾入骨i
    2020-12-22 07:57

    You need to write cron jobs for sending the automatic emails on a particular date. Without this it is not possible.

    Syntax Here is a simple cron job:

    10 * * * * /usr/bin/php /www/virtual/username/cron.php > /dev/null 2>&1
    

    There are two main parts:

    The first part is "10 * * * *". This is where we schedule the timer.
    The rest of the line is the command as it would run from the command line.
    The command itself in this example has three parts:
    
    "/usr/bin/php". PHP scripts usually are not executable by themselves. Therefore we need to run it through the PHP parser.
    "/www/virtual/username/cron.php". This is just the path to the script.
    "> /dev/null 2>&1". This part is handling the output of the script.
    

    Timing Syntax

    This is the first part of the cron job string, as mentioned above. It determines how often and when the cron job is going to run.

    It consists of five parts:

    minute
    hour
    day of month
    month
    day of week
    

    Or

    You can set the cron in you cpanel.

提交回复
热议问题