Jump to content

Inserting a time delay into a mail function


MunsonBurner

Recommended Posts

mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "From: ".$from." <".$Email.">");

 

 

This is my mail function, which works fine and sends an email automatically to $ToEmail.

 

I would like to delay the sending of the email by 15 minutes to mimic a real person response as opposed to an automatic one.

 

Any ideas?

 

Cheers

you can use sleep() but is this an automailer? why would you need to make one to wait? well, you can make a cron job for sending mail then check the log of the mail to send it 15 mins right after.

 

but am just curious, why would you want to do that?

sleep() allows your program to halt for a while its execution in terms of seconds, say sleep(60) will halt for 1 minute.

 

but this is not a good idea for 15 mins since its still occupying the server until its done so i dont really recommend it. maybe make a timestamp on the mail being sent... then with cronjob, check the timestamp, send if about 15 mins have passed.

 

but why would you want to do this... i feel its somehow unnecessary, unless you have good point for doing so.

The client does not want the user to receive an email automatically, only after 15 minutes so it seems like someone wrote a reply to their enquiry there and then (for effect really).

 

I have the basic cron task here but I don't know how to activate it (where to put it?) ;

 

57 14 * * * /www/response/cgi-bin/response_info.php

58 14 * * * /www/response/cgi-bin/response_info.php

59 14 * * * /www/response/cgi-bin/response_info.php

0  15 * * *  /www/response/cgi-bin/response_info.php

01 15 * * * /www/response/cgi-bin/response_info.php

 

 

cheers

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.