1
ramjet
Send mail to groups
  • 2005/9/15 0:35

  • ramjet

  • Just popping in

  • Posts: 14

  • Since: 2005/9/10


I am needing to include a function in one of my custom modules that will send an email to all people in spcified groups (2 to be exact). I would send the mail subject and msg body in strings and the rest would be Xoops...

Anyone have code that does this?

Thanks!

2
rabideau
Re: Send mail to groups
  • 2005/9/15 3:17

  • rabideau

  • Home away from home

  • Posts: 1042

  • Since: 2003/4/25


try the module "evenews"
Pax vobiscum,
...mark

may the road rise to meet your feet!

http://treemagic.org

3
ramjet
Re: Send mail to groups
  • 2005/9/16 11:02

  • ramjet

  • Just popping in

  • Posts: 14

  • Since: 2005/9/10


Well I was able to get there on my own... Nothing really hit the spot in the modules... This code is used in conjuntion with a custom module (with a custom input form) that ends up dumping tracking data into a database for later charting (a bit more complex than the ones in the module repository now - nowever very business specific)...

Note: _xoops__groups_users_link.groupid = '4'" //The 4 is the group ID I am looking to send the mail to

So here it is:

mysql_connect(XOOPS_DB_HOST, XOOPS_DB_USER, XOOPS_DB_PASS) or die("Unable to connect to host $server");
mysql_select_db(XOOPS_DB_NAME) or die("Unable to select database $db");
//----Get Email addys
$query = "SELECT _xoops__users.email FROM _xoops__users INNER JOIN _xoops__groups_users_link ON _xoops__groups_users_link.uid = _xoops__users.uid WHERE _xoops__groups_users_link.groupid = '4'";
$result = mysql_query($query);
$number = mysql_numrows($result);
for($x=$number; $x>0; $x--)
{
$myemail = $myemail . mysql_result($result, $x, "email").";";
?>

//Create your message here-------
$subject = "Your stuff here";
$from = (Xoops UID);
$message = "Your stuff here";

//Then send your message
if ($myemail != "")
mail($myemail, $subject, $message, $from);

Login

Who's Online

389 user(s) are online (281 user(s) are browsing Support Forums)


Members: 0


Guests: 389


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits