user emails to form

5 posts by 2 authors in: Forums > CMS Builder
Last Post: August 12, 2011   (RSS)

By Toledoh - August 10, 2011

Hi Guys.

I'm wanting to send an email to a few selected email address; like;
$to = "tim@domain.com.au,tim@another.com.au";

I want to create a list of comma separated emails based of the user table...

In the user table, I've got a checkbox "Notifications".

Im thinking something along the lines of;

for each $CURRENT_USER[notifications]
$email= $CURRENT_USER[email]
$emailList = $emailList + ,email
$email= ""

This way, in the email function I can have;

$to = "$emailList";
Cheers,

Tim (toledoh.com.au)

Re: [Toledoh] user emails to form

By Jason - August 11, 2011

Hi Tim,

What is stored in $CURRENT_USER['notifications']? Is it a multi-value check box list of emails?

Let me know and we'll try to come up with a solution for you.

Thanks,
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

Re: [Toledoh] user emails to form

By Jason - August 12, 2011

Hi Tim,

So what you need is to select all users who have the notifications check box checked and are selected for the project selected in $_REQUEST['project'] and create a comma-separated list of those emails.

Is that right?

If so, you can use something like this:
$accounts = mysql_query_fetch_all_assoc("SELECT * FROM `{$TABLE_PREFIX}accounts` WHERE notifications = '1' AND project LIKE '%\t".intval(@$_REQUEST['project'])."\t%'");
$emailList = join(",", array_pluck($accounts, 'email'));


Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

Re: [Jason] user emails to form

By Toledoh - August 12, 2011

WOW - perfect.

Thanks Jason!
Cheers,

Tim (toledoh.com.au)