email entire member list (Using the Membership Module)

We would like the capability to email the entire member list. Any ideas on what we may need to do?

Thank you.

Re: [Jason] email entire member list (Using the Membership Module)

We have created a members only homeowners association website and need the ability to send plain text emails to all of the users within the cmsbuilder member list (Using the Membership module.)

For example: All the homeowners need to know the snow plows are running late and will be at the property by 1:00pm.

So we want to add the ability to enter a message hit send and all 160+ members (That have emails associated to their account) would receive the email.

PS
The admin user would be the only person able to send messages out.

Re: [Christopherb] email entire member list (Using the Membership Module)

After some thought, what would be a good form-to-mail php script to use if all we want to do is populate the BCC field with all the users within the CMS builder database?

Re: [Christopherb] email entire member list (Using the Membership Module)

By Jason - April 18, 2011

Hi,

There's a function with CMS Builder called sendMessage() that lets you send emails.

What you can do is set up an HTML form that has 2 fields, one called "subject" and then one called "message". In the action of this form, you can have the form submit to itself (ie, action = "?" ).

At the top of your script you can use this code:

if (@$_REQUEST['subject'] && @$_REQUEST['message'] && $CURRENT_USER['isAdmin']) {

list($membersRecords, $membersMetaData) = getRecords(array(
'tableName' => 'accounts',
'allowSearch' => false,
));

$emailList = join(",", array_filter(array_pluck($memberRecords, 'email')));

sendMessage(array(
'to' => "to@email.com",
'from' => "from@email.com",
'subject' => @$_REQUEST['subject'],
'text' => @$_REQUEST['message'],
'headers' => array(
'BCC' => $emailList,
),
));

}


This code will only execute if the current user is an administrator and both subject and message were given a value.

What the script does then is get all of the users in "accounts" and create a comma separated list of their emails. It then sends out an email with all of these emails in it's BCC field. You'll need to change the value of the "to" and "from" field to whatever emails you'd like to use.

Hope this helps get you started.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/