private function build_message($part) {
    $message = $part[ "message"];
    // #### only base64 encoding supported
    // #### other encodings you have to encode yourself
    if ($part[ "encode"] == "base64"){
      $message = chunk_split(base64_encode($message));
    }else if ($part[ "encode"] == "quoted-printable"){
      $message = $this->encode_qp($message);
    }
    return  "Content-Type: ".$part[ "ctype"].
            ($part[ "charset"]? "; charset = \"".$part[ "charset"]. "\"" :  "").
            ($part[ "name"]? "; name = \"".$part[ "name"]. "\"" :  "").
            (empty($part[ "encode"])? "" : "\nContent-Transfer-Encoding: ".$part[ "encode"] ).
            (empty($part[ "contentid"])? "" : "\nContent-ID: ".$part[ "contentid"] ).
            ((empty($part["contentid"])&&($part["name"]))? "\nContent-Disposition: attachment; filename=\"".$part["name"].'"' : '' ).
            "\n\n$message\n";
  }