天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

php實現的發送帶附件郵件類實例

本文實例講述了php實現的發送帶附件郵件類的方法,是一個非常實用的功能。分享給大家供大家參考。具體方法如下:

emailclass.php類文件如下:

<? class CMailFile {     var $subject;    var $addr_to;    var $text_body;    var $text_encoded;    var $mime_headers;    var $mime_boundary = "--==================_846811060==_";    var $smtp_headers;       function CMailFile($subject,$to,$from,$msg,$filename,$downfilename,$mimetype = "application/octet-stream",$mime_filename = false) {      $this->subject = $subject;         $this->addr_to = $to;         $this->smtp_headers = $this->write_smtpheaders($from);     $this->text_body = $this->write_body($msg);     $this->text_encoded = $this->attach_file($filename,$downfilename,$mimetype,$mime_filename);     $this->mime_headers = $this->write_mimeheaders($filename, $mime_filename);   }     function attach_file($filename,$downfilename,$mimetype,$mime_filename) {     $encoded = $this->encode_file($filename);     if ($mime_filename) $filename = $mime_filename;     $out = "--" . $this->mime_boundary . "/n";     $out = $out . "Content-type: " . $mimetype . "; name=/"$filename/";/n";     $out = $out . "Content-Transfer-Encoding: base64/n";     $out = $out . "Content-disposition: attachment; filename=/"$downfilename/"/n/n";     $out = $out . $encoded . "/n";     $out = $out . "--" . $this->mime_boundary . "--" . "/n";     return $out;   }     function encode_file($sourcefile) {      if (is_readable($sourcefile)) {        $fd = fopen($sourcefile, "r");        $contents = fread($fd, filesize($sourcefile));        $encoded = chunk_split(base64_encode($contents));        fclose($fd);      }      return $encoded;    }     function sendfile() {       $headers = $this->smtp_headers . $this->mime_headers;      $message = $this->text_body . $this->text_encoded;      mail($this->addr_to,$this->subject,$message,$headers);    }     function write_body($msgtext) {      $out = "--" . $this->mime_boundary . "/n";      $out = $out . "Content-Type: text/plain; charset=/"us-ascii/"/n/n";      $out = $out . $msgtext . "/n";      return $out;    }     function write_mimeheaders($filename, $mime_filename) {      if ($mime_filename) $filename = $mime_filename;      $out = "MIME-version: 1.0/n";      $out = $out . "Content-type: multipart/mixed; ";      $out = $out . "boundary=/"$this->mime_boundary/"/n";      $out = $out . "Content-transfer-encoding: 7BIT/n";      $out = $out . "X-attachments: $filename;/n/n";      return $out;    }     function write_smtpheaders($addr_from) {      $out = "From: $addr_from/n";      $out = $out . "Reply-To: $addr_from/n";      $out = $out . "X-Mailer: php3/n";      $out = $out . "X-Sender: $addr_from/n";      return $out;    }  }   /*用法 - 例如:mimetype 為 "image/gif"   $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filename,$mimetype);   $mailfile->sendfile();    $subject -- 主題   $sendto -- 收信人地址   $replyto -- 回復地址   $message -- 信件內容   $filename -- 附件文件名   $downfilename -- 下

主站蜘蛛池模板:
亚洲乱亚洲乱妇13p
亚洲乱色视频在线观看
|
麻豆高清区在线
|
中文字幕一区久久久久
|
青青热久精品国产亚洲AV无码
|
99精品无码AV在线播放
|
热久久2018亚洲欧美
|
久久久免费热线精品频
|
无限资源在线完整高清观看1
|
亚洲精品www久久久久久久软件
|
最新国产精品视频免费看
|
久久电影院久久国产
|
亚洲色tu|
jzz大全18|
国产一卡在线观看完整版
|
2022久久精品国产色蜜蜜麻豆
|
黄页网址大全免费观看
|
国产精品丰满人妻AV麻豆
|
热99re久久精品国产首页
|
色噜噜视频
|
99久久精品免费看国产一区二区三区
|
香蕉 在线播放
|
国产精品手机在线视频
|
欧美激情精品久久久久
|
国产偷窥盗摄一区二区
|
精品人妻一区二区三区视频53
|
亚洲免费va在线观看
|
亲嘴扒胸摸屁股视频免费网站
|
婷婷四房播客五月天
|
影音先锋av天堂
|
好大好硬好湿再深一点网站
|
精品久久免费观看
|
校花被扒衣吸乳羞羞漫画
|
久久国产精品自线拍免费
|
亚洲成人黄色在线
|
亚洲区视频在线观看
|
色妺妺免费影院
|
父亲在线日本综艺免费观看全集
|
国产精品69人妻无码久久
|
国产精品一国产AV麻豆
|
国产成人免费不卡在线观看
|
18video性欧美19sex高清
|