Allow user to request resend of activation email I would like to code a way for a user to request the activation email be resent. Is there a function I can call from within a form-submit hook that will accomplish this?

(using Drupal 7)
First you need to create a custom form page using hook_menu() to allow users to enter their emails.

 /**
 * Implements hook_menu().
 */
function custom_user_menu() {
  $items = array();

  $items['user/trouble'] = array(
    'title' =&gt; 'trouble logging in',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('custom_user_trouble_logging_in_form'),
    'access callback' =&gt; TRUE,
  );

  return $items;
}


Second, you need to create form structure 

function custom_user_trouble_logging_in_form($form, &amp;$form_state) {
  $form['mail'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; t('E-Mail address'),
    '#size' =&gt; 60,
    '#required' =&gt; TRUE,
  );

  $form['actions'] = array('#type' =&gt; 'actions');
  $form['actions']['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; t('Resend activation email'),
  );

  return $form;
}


Third, validation step (check if user email already registered)

/*
 * Validation function
 */
function custom_user_trouble_logging_in_form_validate($form, &amp;$form_state) {
  $account = user_load_by_mail($form_state['values']['mail']);

  if(!$account) {
     form_error($form['mail'], t('Invalid user email'));
  }
}


Fourth, resend user activation email on form submission.

/*
 * Submit function for the 'Re-send welcome message'.
 */
function custom_user_trouble_logging_in_form_submit($form, &amp;$form_state) {
  global $language;

  $destination = array();

  if (isset($_GET['destination'])) {
    $destination = drupal_get_destination();
    unset($_GET['destination']);
  }

  $account = user_load_by_mail($form_state['values']['mail']);
  $user_register = variable_get('user_register', 2);

  switch ($user_register) {
    case 0:
      $op = 'register_admin_created';
      break;
    case 1:
      $op = 'register_no_approval_required';
      break;
    case 2:
      $op = 'register_pending_approval';
      break;
  }

  $mail = _user_mail_notify($op, $account, $language);
  if (!empty($mail)) {
    watchdog('user', 'Welcome message has been re-sent to %name at %email.', array('%name' =&gt; isset($account-&gt;realname)? $account-&gt;realname : $account-&gt;name, '%email' =&gt; $account-&gt;mail));
    drupal_set_message(t('Welcome message has been re-sent to %name at %email', array('%name' =&gt; isset($account-&gt;realname)? $account-&gt;realname : $account-&gt;name, '%email' =&gt; $account-&gt;mail)));
  } else {
    watchdog('user', 'There was an error re-sending welcome message to %name at %email', array('%name' =&gt; isset($account-&gt;realname)? $account-&gt;realname : $account-&gt;name, '%email' =&gt; $account-&gt;mail));
    drupal_set_message(t('There was an error re-sending welcome message to %name at %email', array('%name' =&gt; isset($account-&gt;realname)? $account-&gt;realname : $account-&gt;name, '%email' =&gt; $account-&gt;mail)), 'error');
  }
  $form_state['redirect'] = $destination;
}


Note: custom_user is the name of the module that I used. You can change to whatever you like.