title: Use dynamic e-mail generation in hook_mail()
body: <p>Is it possible to dynamically generate <code>cases</code> in PHP <code>switch</code> statements, as in this example of  <code>hook_mail()</code> ?</p>
  
  <pre><code>/*
   * Implement hook_mail().
   */
  
  function rsvp_mail($key, &amp;$message, $params) {
    $guests = rsvp_query();
    foreach ($guests as $account) {
      switch($key) {
        case "invite $account-&gt;uid" :
          $message['subject'] = "And invitation for $account-&gt;name";
          $message['body'][] = 'Some body text.';
          $message['body'][] = rsvp_get_link($account);
          break;
      }
    }
  }
  </code></pre>