title: Simple script to send email?
body: <p>I use the code to send email:</p>
  
  <pre><code>&lt;?php
  $to = "someone@example.com";
  $subject = "Test mail";
  $message = "Hello! This is a simple email message.";
  $from = "someonelse@example.com";
  $headers = "From:" . $from;
  mail($to,$subject,$message,$headers);
  echo "Mail Sent.";
  ?&gt;
  </code></pre>
  
  <p>But I got:</p>
  
  <p>sendmail: fatal: chdir /Library/Server/Mail/Data/spool: No such file or directory</p>
  
  <p>And I don't know how to add attachment and importantly I need to specify the Content-Type for attachment, can anyone help me?</p>
  
  <p>Thanks!</p>