Send email of form data? I have a block module that looks like this:



Created in the following way:

function VL_newsletter_signup_block_info() {
  $blocks['my-block-id'] = array(
    'info' =&gt; t('Enjoy Stories? - Newsletter Signup'),
  );
  return $blocks;
}

/**
 * Implementation of hook_block_view().
 */
function VL_newsletter_signup_block_view($delta='') {
  $block = array();
  switch ($delta) {
    case 'my-block-id':
      //$block['subject'] = t('Block Name');
      $block['content'] = VL_newsletter_signup_contents();
      break;
  }
  return $block;
}

/**
 * custom html block
 * @return string
 */
function VL_newsletter_signup_contents() {
  return '&lt;div class="col4 stories nobile"&gt;
    &lt;h2&gt;Enjoy stories?&lt;/h2&gt;
    &lt;h3&gt;Sign up to recieve regular news&lt;/h3&gt;
    &lt;form&gt;
        &lt;input type="text" name="first" placeholder="First name"&gt;
        &lt;input type="text" name="last" placeholder="Last name"&gt;
        &lt;input type="email" name="email" placeholder="Email" &gt;
        &lt;input class="send" type="submit" name="submit"&gt;
    &lt;/form&gt;
    &lt;/div&gt;';
}


At the moment my form is static HTML as can be seen, but I plan to use Drupal Form API to render it. My question is: on pressing send, how can I email the form data to a designated admin email address. Can I use triggers somehow or is there another function in Drupal API that could achieve this?
You can use drupal_mail() function to send the mail data. You can also use HTML Mail module to integrate nice email templates.

I have shown drupal_mail() function.

$params = array('current_conditions' =&gt; $data);
  $to = 'user@example.com';
  $message = drupal_mail('example', 'notice', $to, $language, $params, FALSE);
  // Only add to the spool if sending was not canceled.
  if ($message['send']) {
    example_spool_message($message);
  }