PDA

View Full Version : Email system in PHP



Lucky13
July 6th, 2001, 15:19
I just got done making an internal EMail system for my website. It was quite easy, but I can't find a way to make it so that I can send messages it to more than one recipient at a time. If anyone can suggest a way to do this, I would really appreciate it. Thanks a lot.

~Lucky13

findftp
July 6th, 2001, 21:50
In Perl you could do a 'for each' loop. I don't know about PHP.

Beans
July 7th, 2001, 08:35
To send to multiple recipients, you could separate their email addresses by a comma.

So, it would be nice to store the email addresses in a variable:

$addresses = "email1@email.com, email2@email.com, email3@email.com"

Substitute $address to the recipient part of the mail() function.

Lucky13
July 15th, 2001, 12:24
1st of all...sorry fgor not replying at all to my own thread...I just got back from spending 7 days in complete wilderness.

Anyway...Beans...I should have been more clear....this is not an actual Email system...it's a private message system within my website. If you send it to "person1, person2" it won';t work because it looks for only person1 when I say

FROM db WHERE recip="person1" or something like that.

Is there a way to make it so if it sees person1 the list it will count? Something like

FROM db WHERE recip[contains]"person1" ??

Thanks a lot.

~Lucky13

lucifer
July 16th, 2001, 05:44
can't you just allow person1,person2...

split it at ,

find the email address from the db for each person

send the emails?

Lucky13
July 16th, 2001, 06:24
that could work...how would I do that?

lucifer
July 16th, 2001, 06:49
something like

$list="fred,tim,bob";
$arraylist=explode(",",$list);
for($i=0;$i<count($arraylist);$i++){
$result=mysql_db_query($db,"select email from table where name='" + $arraylist[$i] + "'");
..... get email address and send
}

Lucky13
July 16th, 2001, 06:52
great...I'll try that....thanks a lot.