Forum Moderators: coopster

Message Too Old, No Replies

Adding extensions

         

Saboi

4:21 pm on Oct 9, 2007 (gmt 0)

10+ Year Member



Guys, i would like to send the same sms to multiple recipients and my code takes in a list of these numbers.

The code below shows what i do with the numbers.

<?php

$recipients=$_POST["sms_recipients"];

$message_to_send=$_POST["text"];

$fh = fopen("numbers.txt","w");

fwrite($fh, $recipients);

fclose($fh);

$number_list = file("numbers.txt");

$total_numbers = count($number_list);

for($counter=0; $counter<$total_numbers; $counter++)

{ $number_list[$counter] = trim($number_list[$counter]);

}

$numbers = implode(",", $email_list);

$list = implode("<br>", $numbers);

mail($to=$reciever, $subject=$sub, $message="$message_to_send");

?>

I need some assistance. What needs to be done is that to each number must be an extension - @example.com. In front of each i also need to add the number 26, the country code. In the end a number must be something like 26number@example.com.

Please assist me on how to do this.

Thanks.

Saboi

[edited by: eelixduppy at 8:29 pm (utc) on Oct. 9, 2007]

dreamcatcher

11:47 am on Oct 10, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Saboi,

If I`m reading this correctly, your loop would be better as:

$array = array();
for($counter=0; $counter<$total_numbers; $counter++)
{

$array[] = '26'.trim($number_list[$counter]).'@example.com';

}

Then in your mail function:

mail(implode(",",$array), $subject=$sub, $message="$message_to_send");

Or isn`t that what you were after?

dc