Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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;
  }
}
share|improve this question
pls help....... – Lasitha Kumara Gamage Apr 17 at 5:48

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.