title: PHP Mail() function dealing with HTML / Text and attachments
body: <p>I'm using PHP mail() function for my emails, now I want to add new things but don't know how to deal with that..</p>
  
  <p>My basic PHP Mail class that I've created is the following :</p>
  
  <pre><code>&lt;?php
  
  class Send_Mail {
  
      private $to = array();
      private $subject = null;
      private $from = null;
      private $replyTo = null;
      private $type = self::TEXT;
  
      const HTML = 0;
      const TEXT = 1;
  
      public function __construct() {
      }
  
      public function setTo($array) {
          $this-&gt;to = $array;
      }
  
      public function setType($type) {
          if($type == self::HTML || $type == self::TEXT) {
              $this-&gt;type = $type;
          }
      }
  
      public function setSubject($subject) {
          $this-&gt;subject= $subject;
      }
  
      public function setMessage($message) {
          $this-&gt;message = $message;
      }
  
      public function setFrom($from) {
          $this-&gt;from = $from;
      }
  
      public function send() {
  
          if  (   $this-&gt;to == array()    || 
                  $this-&gt;from == null     ||
                  $this-&gt;message == null
              ) {
                  trigger_error("The email can't be sent ! One of the mandatory fields at least isn't set !");
                  return false;
          }
          else {
  
              $this-&gt;to       = implode(',', $this-&gt;to);
  
              $this-&gt;subject = ($this-&gt;subject == null) ? "" : $this-&gt;subject;
  
              $headers    = array();
              $headers[]  = "MIME-Version: 1.0" . "\r\n";
  
              if($this-&gt;type == self::HTML) {
                  $headers[]  = "Content-type: text/html; charset=UTF-8" . "\r\n";
              } else {
                  $headers[]  = "Content-type: text/plain; charset=UTF-8" . "\r\n";
              }
  
              $headers[]  = "To: " . $this-&gt;to . "\r\n";
              $headers[]  = "From: " . $this-&gt;from . "\r\n";
  
  
              $headers[]  = "Reply-To: " . $this-&gt;from . "\r\n";
  
              return mail($this-&gt;to, $this-&gt;subject, $this-&gt;message, implode('', $headers));
          }
      }
  
  }
  
  */
  ?&gt;
  </code></pre>
  
  <p>So basically I can't send attachments.. I also want to add <strong>multiple</strong> BCC and <strong>multiple</strong> CC support.</p>
  
  <p>Along with the fact that lines should not be longer than 70 characters as said in PHP documentation. How can I deal with that knowing that I can break a HTML tag if I use <strong>wordwrap</strong>? :(</p>