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.
- Add a button to the List page
- 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.