Timeout handle email php

64 views Asked by At

I would like to redirect my user to a new page, but the current site continues to run a script that sends a threaded message 10 minutes later at a specified address. I tried something like this:

Header('Location: xy.com');
sleep(100);
do_the_email_sending_here();

But actually it doesn't worked,because the site waited for 100sec, so the site is not immediately redirected me. Any idea how can i solve this? Any idea for while() or for() loop?

2

There are 2 answers

0
szebasztian On BEST ANSWER

Solution for the problem: Cron Job , Good learning.

1
brandon Whe On

Try this:

         Header("Refresh: 600;", "Location: xy.com");
         do_the_email_sending_here();

The Refresh: 600; will preform your header in 600 seconds or 10 minutes.