日期:2011-01-29  浏览次数:20422 次

<?php

    // 存成 "mime_mail.inc" 檔案

    class mime_mail {

        var $parts;
        var $to;
        var $from;
        var $headers;
        var $subject;
        var $body;


        /*
         *     void mime_mail()
         *     類別建構者
         */

        function mime_mail() {
            $this->parts = array();
            $this->to = "";
            $this->from = "";
            $this->subject = "";
            $this->body = "";
            $this->headers = "";
        }


        /*
         *     void add_attachment(string message,
         *                         [string name],
         *                         [string ctype])
         *     將附加物(附檔)加入郵件物件
         */

        function add_attachment($message, $name = "",
                    $ctype = "application/octet-stream") {
            $this->parts[] = array( "ctype" => $ctype,
                            "message" => $message,
                        "encode" => $encode,
                        "name" => $name);
        }


        /*
         *     void build_message(array part)
         *     建立 multipart 郵件的訊息部份
         */

        function build_message($part) {
            $messa