Send mail with attachment using the MIME Mail module
The solution I've found is to use hook_mail_alter to attach the file to the email after it's generated and before it's sent. The key to that is making an array of details about your attachment and adding that to $message['params']['attachments'].

hook_mail will send mail, but if you're using another program to send (Swift Mailer or PET), then I believe you'll need hook_mail_alter to alter the mail instead of sending it yourself.

I also suggest using the Form API (also this) to keep track of your file. That's not required, however, just provide the necessary info.

function myhook_mail_alter(&amp;$message) {

  print "message id: {$message['id']}\n";

  // if this email is one of the ones I want to alter:
  if (!empty($message['id']) &amp;&amp; (preg_match('/^message-id-set-by-formmail[\d]{1,2}/', $message['id']))) {

    // $message['params']['body'] is a single string, not an array
    $result = preg_match('/\[my dumb string with node id# (\d+)]/', $message['params']['body'], $matches);

    print "Message body: \n {$message['params']['body']} \n\n Matches:\n";
    print_r($matches);

    if (!empty($matches[1])) {
      $file_id = $matches[1];
      $my_pdf = file_load($file_id);
      $original_attachments = $message['params']['attachments'];
      // $original_attachments is an array of associative arrays, each bearing details about an attachment.
      // Add an associative array about this desired attachment.
      $my_attachment = array(
        'filecontent' =&gt; file_get_contents($my_pdf-&gt;uri),
        'filemime' =&gt; $my_pdf-&gt;filemime,
        'filename' =&gt; $my_pdf-&gt;filename,
        'filepath' =&gt; NULL,
      );
      $message['params']['attachments'][] = $my_attachment;
    }

  }
}