User Profile

User
 Gkelly
Location
 Hazlet, NJ
Time Zone
 (GMT -5): USA Eastern, Bahamas, Canada Eastern, Colombia, Haiti, Panama
URL
 http://www.internaq.com

Recent Articles

Report Creator Component

Under most circumstances web-based intranet applications call for some type of flexible reporting for its users. Report design is often times a fixed process which immobilizes a user's ability to create new reports on the fly. Utilizing some existing ingredients within Cake I managed to bake a fairly straightforward reporting component that can easily integrate into any Cake application.
  • Published by Gkelly 11/09/06 - 23:53
  • 21544 views
  • 9 comments

Recent Comments

Posted 30/11/-0001 12:00am
This code will allow users to email multiple addresses.

1. Put the folowing line inside your controller action:
$this->Email->attach_to($to_address, $to_name);
/*Add this line as many times as you want.*/

2. Add the following to the email component.
//Initialize variable
var $to_arr = null;

//Add function
function attach_to($to_address, $to_name = '') {
if (empty($this->to_arr)) {
$this->to_arr = array();
$this->to_arr[0]['to_address'] = $to_address;
$this->to_arr[0]['to_name'] = $to_name;
} else {
$count = count($this->to_arr);
$this->to_arr[$count+1]['to_address'] = $to_address;
$this->to_arr[$count+1]['to_name'] = $to_name;
}
}

//Add this loop within the send function
if (!empty($this->to_arr)) {
foreach ($this->to_arr as $to) {
$mail->AddAddress($to['to_address'], $to['to_name']);
}
}


Thats it hope it helps someone out.

~Gene Kelly
Posted 30/11/-0001 12:00am
The version is at the top right of the article. I will include it in the read me as well sorry.

Make sure that the models you include in your model array are also included in the uses array in your controller. This is the only obvious reason I can think that this is not working for you. I have not tested this with any other versions of cake.

Thanks,
Gene