i have function which select matched donation for charity and i want to display all that donation data inside the body of druapl email,how can i achieve that..,can i run foreach inside drupal email function,
this is the way i tryied but it did'nt work,it gives error Undefined variable: bodycontent
foreach($matched_donations as $ee) {
$nobject = node_load($ee);
//$bodycontent.="<h1>".$nobject->title."</h1>";
$bodycontent.="<hr>";
$bodycontent.="<h1>".$nobject->title."</h1>";
$bodycontent.="<hr>";
}
and this is mail function
function zg_mail ($key, &$message, $params) {
switch ($key) {
case 'mymail':
// Set headers etc
$headers['Content-Type'] = 'text/html; charset=UTF-8; format=flowed';
$message['subject'] = t('one email for all matches>>>>>>>>TEST01');
$message['body'][] =$bodycontent;
break;
}
}