Jump to content

mailling a group of users


shopies

Recommended Posts

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
Link to comment
https://forums.phpfreaks.com/topic/16779-mailling-a-group-of-users/
Share on other sites

Hi

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

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

while ($userArray = mysql_fetch_array($result)) {
    mail ($userArray['email'],"Title","Body","Headers");
}
[/code]
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

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

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

Archived

This topic is now archived and is closed to further replies.

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