title: Simple PHP form: Attachment to email (code golf)
body: <p>Imagine a user that would like to put a form on their website that would allow a website visitor to upload a file and a simple message, which will immediately be emailed (ie, the file is not stored on the server, or if it is then only temporarily) as a file attachment with the note in the message body.</p>
  
  <p>See more details at <a href="http://a2zsollution.com/php-secure-e-mail/" rel="noreferrer">http://a2zsollution.com/php-secure-e-mail/</a></p>
  
  <p>What is the simplest way to accomplish this?</p>
  
  <p>Simplest in terms of:</p>
  
  <ul>
  <li>Size (code golf)</li>
  <li>Ease of implementation (ideally all in one file, needs few to no external resources)</li>
  <li>Not obfuscated for the sake of obfuscation (tradeoffs for size are fine)</li>
  <li>Self contained example (if called without a form post, it displays the form)</li>
  </ul>
  
  <p>This is nearly the reverse of: <a href="https://stackoverflow.com/questions/114953/how-to-get-email-and-their-attachments-from-php">How to get email and their attachments from PHP</a>.  It almost could have been answered in <a href="https://stackoverflow.com/questions/720455/compiling-email-with-multiple-attachments-in-php">Compiling email with multiple attachments in PHP</a>, but it doesn't actually show code. </p>