0

I need to send email to multiple persons at specific time and date. Specific time and date are

1. At 10am each morning
2. On Sunday morning at 10:01 am
3. On the last day of each month,at 10:02 am
4. On April 1 10:03 am
5. On July 1 10:03 am
6. On October 1 10:03 am
7. On Jan 1 10:03 am
8. on Jan 1 10:04 am

email will send from server and recipient will be collected from Database. Please help me to get these time and date automatically with PHP. This process will automatic.

3
  • Do you know anything about cron? Commented Dec 4, 2013 at 5:38
  • create cron job..in phpmyadmin Commented Dec 4, 2013 at 5:39
  • @sectus I don't know about cron Commented Dec 4, 2013 at 5:40

1 Answer 1

1

What you need to do is create a cronjob that will run a PHP script that processes it.

You can learn how to setup a cronjob either here (if running your own server) http://en.wikipedia.org/wiki/Cron, or contact your hosting provider for assistance.

As for getting the time and date in PHP, you can use the date function (https://www.php.net/function.date).


Example

Cron

  1. 0 10 * * * user /path/to/file1.php
  2. 03 10 1 1 * user /path/to/file7.php

Code

  1. if(date("H") == 10)
  2. if(date("M") == 1 && date("d") == 1 && date("H") == 10 && date("i") == 3)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.