A mime mail class is found .. Partsarray (); $ this-to; $ this-from; $ this-subject; $ this-body; $ this-headers;} ** voidadd_attachment (stringmessage, * [stringname], * [stringctype]) * Parts = array (); $ this-> to = ""; $ this-> from = ""; $ this-> subject = ""; $ this-> body = ""; $ this-> headers = "";}/** void add_attachment (string message, * [string name], * [string ctype]) * Add an attachment to the receiver object */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) * create the information part of the multipart Upload File */function build_message ($ part) {$ message = $ part ["message"]; $ message = chunk_split (base64_encode ($ message); $ encoding = "base64"; return "Content-Type :". $ part ["ctype"]. ($ part ["name"]? "; Name = "". $ part ["name"]. """:""). "Content-Transfer-Encoding: $ encoding $ message";}/** void build_multipart () * Create a multipart Upload File */function build_multipart () {$ boundary = "B ". md5 (uniqid (time (); $ multipart = "Content-Type: multipart/mixed ;". "boundary = $ boundary ". "This is a MIME encoded message. -- $ boundary "; for ($ I = sizeof ($ this-> parts)-1; $ I >=0; $ I --) {$ multipart. = "". $ t His-> build_message ($ this-> parts [$ I]). "-- $ boundary";} return $ multipart. "--";}/** string get_mail () * Restore the assembled parts */function get_mail ($ complete = true) {$ mime = ""; if (! Empty ($ this-> from) $ mime. = "From:". $ this-> from. ""; if (! Empty ($ this-> headers) $ mime. = $ this-> headers. ""; if ($ complete) {if (! Empty ($ this-> to) $ mime. = "To: $ this-> to"; if (! Empty ($ this-> subject) $ mime. = "Subject: $ this-> subject";} if (! Empty ($ this-> body) $ this-> add_attachment ($ this-> body, "", "text/plain"); $ mime. = "maid: 1.0 ". $ this-> build_multipart (); return $ mime;}/** void send () * send this letter (the last called Letter) */function send () {$ mime = $ this-> get_mail (false); mail ($ this-> to, $ this-> subject ,"", $ mime) ;}// do you want to end with a different type?>
Http://www.bkjia.com/PHPjc/531858.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/531858.htmlTechArticleparts = array (); $ this-> to =; $ this-> from =; $ this-> subject =; $ this-> body =; $ this-> headers =;}/** void add_attachment (string message, * [string name], * [string ctype]) *...