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

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

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]
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.