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.
What is the simplest way to accomplish this?
Simplest in terms of:
- Size (code golf)
- Ease of implementation (ideally all in one file, needs few to no external resources)
- Not obfuscated for the sake of obfuscation (tradeoffs for size are fine)
- Self contained example (if called without a form post, it displays the form)
This is nearly the reverse of: How to get email and their attachments from PHP, and could almost have been answered in Compiling email with multiple attachments in PHP but it doesn't actually show code.