pewee Posted September 4, 2006 Share Posted September 4, 2006 I need to send internal message to more than one user simultaneously. The system is made to send «one internal message to only one user" at the time.The code used to send is:[code]$sendto = 189;[/code] when user ID is '189' , when I load the page it's working very well and sends message to member ID 189.I wanted to send simultaneously to a list of user that I have 189, 234, 2578, 6890, etc.. that list can be located on an external txt file.Each time a user will be sent a message an email is also send by the system to inform him of a new message in his mail box.It would be cool if I can have a 10 seconds pause between the sending... let's say[code]$sendto = 189;pause of 10sec $sendto = 234pause of 10sec $sendto = 2578etc...[/code] Any idea how to do that ?I 'll appreciate any help_ Thanks Quote Link to comment Share on other sites More sharing options...
AndyB Posted September 4, 2006 Share Posted September 4, 2006 pause? use the sleep() function ... sleep(10) pauses ten seconds Quote Link to comment Share on other sites More sharing options...
pewee Posted September 4, 2006 Author Share Posted September 4, 2006 Thanks for the reply,[code]sleep() function ;$sendto = 189;sleep(10); $sendto = 234;sleep(10);$sendto = 2578;... etc [/code]is that what you have in mind? Quote Link to comment Share on other sites More sharing options...
AndyB Posted September 4, 2006 Share Posted September 4, 2006 Almost. Just remove the line that says sleep() function; the rest is fine. Quote Link to comment Share on other sites More sharing options...
syed Posted September 4, 2006 Share Posted September 4, 2006 Use this script to read a file line by line so u can store the numbers in the file as u suggested earlier.<?php $lines = file('data.txt'); foreach ($lines as $line_num => $line) { print $line; }?> Quote Link to comment Share on other sites More sharing options...
pewee Posted September 4, 2006 Author Share Posted September 4, 2006 Hello, thanks for fast reply;I tried that:[code]$sendto = 189;sleep(10); $sendto = 16067;sleep(10);[/code]looks like something is missing, because I don't know why It is sending only to the last member ID "16067" not to the first "189" Quote Link to comment Share on other sites More sharing options...
acdx Posted September 4, 2006 Share Posted September 4, 2006 I don't think you can send e-mails just by assigning a value to a variable..EDIT: how about just something like[code]<?phpforeach($members_array as $id){ send_mail_function($id); sleep(10);}?>[/code]Where [b]$members_array[/b] holds all the member IDs and [b]send_mail_function(int id)[/b] sends the e-mail. Quote Link to comment Share on other sites More sharing options...
pewee Posted September 4, 2006 Author Share Posted September 4, 2006 Hello, this are not emails but internal messages sent within the program. The program then sends emails to inform members of a new messages.The problem that I have today is that i cannot send more than ONE internal message at the time... I was trying to send one message to many members...thanks for thr help Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted September 4, 2006 Share Posted September 4, 2006 [code]<?php// ...send_message(189);sleep(10); send_message(16067);sleep(10);// ...?>[/code]Edit: you obvisouly need to create the send_message() function. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.