Jump to content


Photo

mailling a group of users


  • Please log in to reply
6 replies to this topic

#1 shopies

shopies
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 07 August 2006 - 10:39 AM

Hi,
I'm tryng to make a mailling list program to email multi users in one shot. My problem is I don't know how to get the users that registered in a specific group and send them an email. The mailling groups IDs are saved in one of the users columns devided by "|".

Any help would be highly appreciated in advance :)
Shopies

#2 glenelkins

glenelkins
  • Members
  • PipPipPip
  • Advanced Member
  • 760 posts
  • LocationBridlington - East Riding of Yorkshire - United Kingdom

Posted 07 August 2006 - 10:44 AM

Hi

If the user emails are in a database you need to loop through the users emails to email them all example:

$result = mysql_query("SELECT * FROM users");

while ($userArray = mysql_fetch_array($result)) {
    mail ($userArray['email'],"Title","Body","Headers");
}

http://thewebsolutionprovider.com - A Solution For Everything Web!

#3 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 07 August 2006 - 10:58 AM

I have a script that does what you are talking about. Do want me to upload a zip file with all of the files I use?

Orio.
Think you're smarty?

(Gone until 20 to November)

#4 shopies

shopies
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 07 August 2006 - 11:14 AM

Yes please Orio it would be highly appreciated.

#5 shopies

shopies
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 07 August 2006 - 11:18 AM

Hi glenelkins and thanks for replying. I know how to email them all at once but my problem is that I have mailling groups like (news, articles, pictures ...etc) and I want just to email the users subscribed in news group or articles group.

Thanks

#6 glenelkins

glenelkins
  • Members
  • PipPipPip
  • Advanced Member
  • 760 posts
  • LocationBridlington - East Riding of Yorkshire - United Kingdom

Posted 07 August 2006 - 11:55 AM

ok then you need to check for a value in your db that corresponds to the user having a new group

say the field: NEWS_GROUP = 1

$result = mysql_query("SELECT * FROM users");

while ($userArray = mysql_fetch_array($result)) {
   if ($userArray['NEWS_GROUP'] == 1) {
     mail ($userArray['email'],"Title","Body","Headers");
   }
}

http://thewebsolutionprovider.com - A Solution For Everything Web!

#7 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 07 August 2006 - 12:24 PM

As promissed, the zipped file can be found here:
http://www.oriosriddle.com/email.rar

Go over the files, there's many things you'll need to modify so it will suit your site :)

Orio.
Think you're smarty?

(Gone until 20 to November)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users