MunsonBurner Posted June 25, 2008 Share Posted June 25, 2008 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 Link to comment https://forums.phpfreaks.com/topic/111806-inserting-a-time-delay-into-a-mail-function/ Share on other sites More sharing options...
bluejay002 Posted June 25, 2008 Share Posted June 25, 2008 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? Link to comment https://forums.phpfreaks.com/topic/111806-inserting-a-time-delay-into-a-mail-function/#findComment-573948 Share on other sites More sharing options...
MunsonBurner Posted June 25, 2008 Author Share Posted June 25, 2008 The user will enter their details in a form and then receive a "personal" email 15 minutes after. I'm trying to get my head around cron jobs. How does this sleep function work? Cheers Link to comment https://forums.phpfreaks.com/topic/111806-inserting-a-time-delay-into-a-mail-function/#findComment-573950 Share on other sites More sharing options...
bluejay002 Posted June 25, 2008 Share Posted June 25, 2008 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. Link to comment https://forums.phpfreaks.com/topic/111806-inserting-a-time-delay-into-a-mail-function/#findComment-573960 Share on other sites More sharing options...
MunsonBurner Posted June 25, 2008 Author Share Posted June 25, 2008 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 Link to comment https://forums.phpfreaks.com/topic/111806-inserting-a-time-delay-into-a-mail-function/#findComment-573969 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.