title: Using a php://memory wrapper causes errors
body: <p>I'm trying to extend the PHP mailer class from Worx by adding a method which allows me to add attachments using string data rather than path to the file.</p>
  
  <p>I came up with something like this:</p>
  
  <pre><code>public function addAttachmentString($string, $name='', $encoding = 'base64', $type = 'application/octet-stream')
  {
    $path = 'php://memory/' . md5(microtime());
    $file = fopen($path, 'w');
    fwrite($file, $string);
    fclose($file);
  
    $this-&gt;AddAttachment($path, $name, $encoding, $type);
  }
  </code></pre>
  
  <p>However, all I get is a PHP warning:</p>
  
  <pre><code>PHP Warning:  fopen() [&lt;a href='function.fopen'&gt;function.fopen&lt;/a&gt;]: Invalid php:// URL specified
  </code></pre>
  
  <p>There aren't any decent examples with the original documentation, but I've found a couple around the internet (including <a href="https://stackoverflow.com/questions/1522066/php-create-file-and-send-as-attachment-without-actually-creating-the-file/1522086#1522086">one here on SO</a>), and my usage appears correct according to them.</p>
  
  <p>Has anyone had any success with using this?</p>
  
  <p>My alternative is to create a temporary file and clean up - but that will mean having to write to disc, and this function will be used as part of a large batch process and I want to avoid slow disc operations (old server) where possible. This is only a short file but has different information for each person the script emails.</p>