Send emails using PHPMailer

Trying to figure out how to do this on my own, I’m using the same as above,

The form submits fine—but no attachment.

    uniform::$actions['upload'] = function($form, $actionOptions) {
     foreach ($actionOptions['files'] as $field) {
        if (!array_key_exists($field, $_FILES)) {
           return [
              'success' => false,
              'message' => "Field {$field} was not submitted"
           ];
        }
     }

     foreach ($actionOptions['files'] as $field) {
        move_uploaded_file($_FILES[$field]['tmp_name'], $actionOptions['target'].'/'.$_FILES[$field]['name']);
     }

     return [
        'success' => true,
        'message' => "All files uploaded"
     ];
    };

   $form = uniform('opportunity-form', array(
         'required' => array('_from' => 'email'),
         'actions'  => array(
            array(
              '_action' => 'email',
              'to'      => 'email@address.com',
              'sender'  => 'email@address.com',
              'subject' => 'Submission',
              'service' => 'phpmailer',
            ),
            array(
              '_action' => 'upload',
              'files' => ['file'],
              'target' => 'content/'.$page->diruri().'/files'
            ),
         )
      )
   );