php - Why isn't the body of my message being sent in drupal_mail()? -


i'm new drupal forms have managed set drupal_mail function upon submit sends email desired location correct $subject message , $from email address. not, however, sending body of message. i've googled/tried lot of things nothing seems grab correct value. can see why? in advance help.

function drupalform_menu() { $items['drupalform/form1'] = array(     'type' => menu_callback,     'access arguments' => array('access content'),     'page callback' => 'drupal_get_form',     'page arguments'=>array('drupalform_form1'));    return $items; } ?>   <?php function drupalform_form1() { $form = array(     '#prefix' => '<div id="contact-form" class="row section"><div  class="container">',     '#suffix' => '</div></div>', ); ?>      <?php $form['name']=array(     '#prefix' => '<div class="col l5 s12">',     '#type'=>'textfield',     '#title'=>t('first & last name'),   ); ?>  <?php $form['email']=array(     '#suffix' => '</div>',     '#type'=>'textfield',     '#title'=>t('email'),   ); ?>   <?php $form['message']=array(     '#prefix' => '<div id="form-message" class="col l5 push-l1 s12 ">',     '#type'=>'textarea',     '#title'=>t('message'),   ); ?>  <?php $form['submit']=array(     '#suffix' => '</div>',     '#type'=>'submit',     '#value'=>t('send message')   );    return $form; ?>   <?php } ?>   <?php  function drupalform_form1_submit($form, $form_state) { $to = "test@test.com"; $from = "sender@sender.com"; $subject = "new message louisville digital inclusion site"; $body = $form_state['values']['message'];   $params = array(     'subject' => $subject,     'body' => $body,     );  drupal_mail('test', 'information', $to, language_default(), $params, $from);  drupal_set_message("form has been submitted"); }   function test_mail($key, &$message, $params) { switch ($key) { case 'information':   $message['subject'] = $params['subject'];   $message['body'] = $params['body']; break; } }  ?> 

got figured out! had change test_mail function read follows:

function test_mail($key, &$message, $params) { switch ($key) { case 'information': $message['subject'] = $params['subject']; $message['body'][] = $params['body']; break; } } 

i needed add empty brackets after $message['body'][] = $params['body'].


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -