title: Send Mail from raw body for testing purposes
body: <p>I am developing a PHP application that needs to retrieve arbitrary emails from an email server. Then, the message is completely parsed and stored in a database.</p>
  
  <p>Of course, I have to do a lot of tests as this task is not really trivial with all that different mail formats under the sun. Therefore I started to "collect" emails from certain clients and with different contents. </p>
  
  <p>I would like to have a script so that I can send out those emails automatically to my application to test the mail handling.</p>
  
  <p>Therefore, I need a way to send the raw emails - so that the structure is exactly the same as they would come from the respective client. I have the emails stored as .eml files.</p>
  
  <p>Does somebody know how to send emails by supplying the raw body?</p>
  
  <p><strong>Edit:</strong>
  To be more specific: I am searching for a way to send out multipart emails by using their source code. For example I would like to be able to use something like that (an email with plain and HTML part, HTML part has one inline attachment).</p>
  
  <pre><code> --Apple-Mail-159-396126150
  Content-Transfer-Encoding: quoted-printable
  Content-Type: text/plain;
  
  The plain text email!
  
  --=20    
  
  =20
  =20
  
  --Apple-Mail-159-396126150
  Content-Type: multipart/related;
      type="text/html";
      boundary=Apple-Mail-160-396126150
  
  
  --Apple-Mail-160-396126150
  Content-Transfer-Encoding: quoted-printable
  Content-Type: text/html;
      charset=iso-8859-1
  
  &lt;html&gt;&lt;head&gt;
      &lt;title&gt;Daisies&lt;/title&gt;=20
  &lt;/head&gt;&lt;body style=3D"background-attachment: initial; background-origin: =
  initial; background-image: =
  url(cid:4BFF075A-09D1-4118-9AE5-2DA8295BDF33/bg_pattern.jpg); =
  background-position: 50% 0px; "&gt;
  
  [ - snip - the html email content ]
  
  
  &lt;/body&gt;&lt;/html&gt;=
  
  --Apple-Mail-160-396126150
  Content-Transfer-Encoding: base64
  Content-Disposition: inline;
      filename=bg_pattern.jpg
  Content-Type: image/jpg;
      x-apple-mail-type=stationery;
      name="bg_pattern.jpg"
  Content-Id: &lt;4BFF075A-09D1-4118-9AE5-2DA8295BDF33/tbg.jpg&gt;
  
  /9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAASAAA/+IFOElDQ19QUk9GSUxFAAEB
  [ - snip - the image content ]
  nU4IGsoTr47IczxmCMvPypi6XZOWKYz/AB42mcaD/9k=
  
  --Apple-Mail-159-396126150--
  </code></pre>