Jump to content

need help to modify a code


pewee

Recommended Posts

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 = 234
pause of 10sec
$sendto = 2578
etc...

[/code]


Any idea how to do that  ?

I 'll appreciate any help_ Thanks
Link to comment
Share on other sites

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;
        }

?>
Link to comment
Share on other sites

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"
Link to comment
Share on other sites

I don't think you can send e-mails just by assigning a value to a variable..

EDIT: how about just something like

[code]
<?php
foreach($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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.