This topic is locked

How to get a comma separated list of selected email address

12/1/2015 3:16:32 PM
PHPRunner Tips and Tricks
Sergey Kornilov admin

This is a tip suggested by one of our users.
Here is the situation: you'd like to send an email to several of your users. Users along with their email addresses are stored in the database. You'd like to go to the list page, select a few users, click a button and get a list of comma separated email addresses that can be pasted to your favorite email client like Outlook or Gmail.
Here is how this can be done. There are several ways to achieve this. We will store selected email addresses in a temporary text file.

  1. Add a button to the List page
  2. Server event

$filename = "email.txt";

$body = "";
while($data = $button->getNextSelectedRecord() )

{

$body .= $data['email'] . ",

";

}
// open file

$handle = fopen($filename, "w");
// write data

fwrite($handle, $body);
// close the file pointer

fclose($handle);


3. ClientAfter event. Open a popup with this text file.

mywindow = window.open('email.txt','mywindow', "location=0,scrollbars=1,width=300,height=400");

mywindow.moveTo(400, 400);


Note that this is not the best solution or the most sophisticated one but it is easy to understand and modify.

N
nrodrz 1/13/2016

Hi
How I could do something like this.
Send an email to a group of person adding them one by one or creating a group with modification capability. That means I need to send email to all users in my database but need maybe in some email take out some of the names.