title: Swiftmailer works but page is not shown
body: <p>I have PHP send me an e-mail with swiftmailer when somebody fills in a form.</p>
  
  <p>When I exclude the code of swiftmailer, and execute the form, I get my confirmationpage.</p>
  
  <p>When I include the code of swiftmailer, the mail gets sent, but I don't get my confirmationpage. It just stays on the page of the form after a flicker.</p>
  
  <p>The code to display the confirmation and the code to send the e-mail is all in the same file => registration.php.</p>
  
  <p>Any help appreciated, kind regards.</p>
  
  <p>The formprocessing code in PHP</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Registratie voltooid&lt;/title&gt;
          &lt;meta charset="UTF-8"&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
          &lt;link rel="stylesheet" type="text/css" href="../css/global.css"&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt;Resultaat   registratie&lt;/h1&gt;
          &lt;h2&gt;Persoonlijke info&lt;/h2&gt;
          &lt;p&gt;&lt;span class='green'&gt;Succesvol&lt;/span&gt; geüpload.&lt;/p&gt;&lt;h2&gt;Afbeeldingen&lt;/h2&gt;
          &lt;?php
          error_reporting(E_ALL);
          $allowedTypes = array(IMAGETYPE_PNG, IMAGETYPE_JPEG, IMAGETYPE_GIF, IMAGETYPE_PSD, IMAGETYPE_BMP, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM);
          $input_file_name = "upload";
          $uploads_dir = "../uploads";
          $failed_uploads = [];
          $succeeded_uploads = [];
          foreach ($_FILES[$input_file_name]["error"] as $key =&gt; $error) {
              $name = $_FILES[$input_file_name]["name"][$key];
              if ($error == UPLOAD_ERR_OK) {                                  //UPLOAD_ERR_OK equals errorcode 0 which stands for "no error"
                  $detectedType = exif_imagetype($_FILES[$input_file_name]['tmp_name'][$key]);
                  if (in_array($detectedType, $allowedTypes)) {
                      $tmp_name = $_FILES[$input_file_name]["tmp_name"][$key];
                      move_uploaded_file($tmp_name, $uploads_dir . "/" . $name);
                      $succeeded_uploads = $name;
                  } else {
                      $failed_uploads[] = $name;
                  }
              } else {
                  if ($name != "") {
                      $failed_uploads[] = $name;
                  }
              }
          }
          if (!empty($succeeded_uploads) &amp;&amp; empty($failed_uploads)) {
              echo "Alle afbeeldingen zijn &lt;span class='green'&gt;succesvol&lt;/span&gt; geüpload&lt;/p&gt;";
          } else {
              echo "&lt;p&gt;&lt;span class='green'&gt;Succesvol&lt;/span&gt; geüpload: &lt;span class='green'&gt;" . count($succeeded_uploads) . "&lt;/span&gt;.&lt;br /&gt;&lt;span class='red'&gt;Niet succesvol&lt;/span&gt; geüpload: &lt;span class='red'&gt;" . count($failed_uploads) . "&lt;/span&gt;.";
          }
  
          require_once '../lib_swiftmailer/swift_required.php';
          //// Create the message
          $message = Swift_Message::newInstance($subject)
                  -&gt;setFrom(array('johndoe#derp.com'))
                  -&gt;setTo(array('johndoe#derp.com'))
                  -&gt;setBody($body)
                  -&gt;addPart($body, 'text/html') //alternative body
          ;
  // add uploaded files as attachments
          if (!empty($uploads_dir)) {
              $files = glob("$uploads_dir/*.{jpg,png,gif,tiff,psd,bmp}", GLOB_BRACE); // paths in []
              foreach ($files as $AttachmentRelativePath) {
                  $attachment = Swift_Attachment::fromPath($AttachmentRelativePath);
                  $message-&gt;attach($attachment);
              }
          }
  
  // Set up transport and send
          $transport = Swift_SmtpTransport::newInstance('smtp.derpland.com', 587, 'tls')
                  -&gt;setUsername('xxxxx')
                  -&gt;setPassword('xxxxx')
          ;
          $transport-&gt;setLocalDomain('[127.0.0.1]');
          $mailer = Swift_Mailer::newInstance($transport);
          $mailer-&gt;send($message);
  
  // Remove files from uploaddir
          $allUploadedFiles = glob($uploads_dir . "/*");
          foreach ($allUploadedFiles as $file) {
              unlink($file);
          }
          ?&gt; 
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  #
  
  <p>The form</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;PXL models&lt;/title&gt;
          &lt;meta charset="UTF-8"&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
          &lt;link rel="stylesheet" type="text/css" href="css/registration.css"&gt;
          &lt;style type="text/css"&gt;
  
          &lt;/style&gt;
      &lt;/head&gt;
      &lt;form action="php/registration.php" method="post" enctype="multipart/form-data"&gt;
          &lt;label for="First_nameLabel" class="label"&gt;Voornaam&lt;/label&gt;
          &lt;input type="text" name="First_name" class="inputBox"/&gt;&lt;br /&gt;
          &lt;label for="Last_nameLabel" class="label"&gt;Naam&lt;/label&gt;
          &lt;input type="text" name="Last_name" class="inputBox"/&gt;&lt;br /&gt;
          &lt;label for="E-mailLabel" class="label"&gt;E-mail&lt;/label&gt;
          &lt;input type="text" name="E-mail" class="inputBox"/&gt;&lt;br /&gt;
          &lt;label for="Telephone" class="label"&gt;Telefoon&lt;/label&gt;
          &lt;input type="number" name="Telephone" class="inputBox"/&gt;&lt;br /&gt;
          &lt;label for="Cellphone" class="label"&gt;Gsm&lt;/label&gt;
          &lt;input type="number" name="Cellphone" class="inputBox"/&gt;&lt;br /&gt;
          &lt;label for="gender" class="label"&gt;Geslacht&lt;/label&gt;
          &lt;div class="surroundingDiv inputBox"&gt;
              &lt;input type="radio" name="Gender" checked="checked" value="Vrouw"&gt;Vrouw
              &lt;input type="radio" name="Gender" value="Man"&gt;Man
          &lt;/div&gt;&lt;br /&gt;
          &lt;div id="uploadLabel" class="label"&gt;Uploaden&lt;/div&gt;
          &lt;div class="surroundingDiv"&gt;
              &lt;label id="uploadButton"&gt;
                  Upload foto's
                  &lt;input type="file" multiple="multiple" name="upload[]" accept="image/*" /&gt;
              &lt;/label&gt;
          &lt;/div&gt;
          &lt;input type="submit" value="Bevestigen"&gt;&lt;br /&gt;&lt;br /&gt;
      &lt;/form&gt;
  &lt;/html&gt;
  </code></pre>