|
emailclass.php
復(fù)制代碼 代碼如下:
<?
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);
} www.jbxue.com
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 -- 回復(fù)地址
$message -- 信件內(nèi)容
$filename -- 附件文件名
$downfilename -- 下
主站蜘蛛池模板:
99国产在线精品视频
|
亚洲国产成人爱AV在线播放丿
|
毛片无码免费无码播放
|
青青草国产精品久久
|
老司机亚洲精品影院
|
强开少妇嫩苞又嫩又紧九色
|
性色无码AV久久蜜臀
|
999国产高清在线精品
|
午夜黄视频
|
色婷婷粉嫩AV精品综合在线
|
善良的小峓子2在钱免费中文字
|
国产综合欧美区在线
|
久久亚洲精品无码A片大香大香
|
18禁止看的免费污网站
|
亚洲综合日韩在线2019
|
国产精品自在在线午夜精品
|
日本边添边摸边做边爱边
|
一起洗澡的老师免费播放
|
国产97视频在线观看
|
国产AV精品白浆一区二
|
国产午夜免费不卡精品理论片
|
欧美97色伦影院在线观看
|
99精品视频
|
国产午夜三区视频在线
|
伦理片免费秋霞e
|
国产欧美一区二区三区免费
|
久久伊人男人的天堂网站
|
葵司中文第一次大战黑人
|
果冻传媒在线观看网站
|
免费一级毛片在线观看
|
国产日韩精品一区二区三区在线
|
亚洲人女同志video
|
国产欧美日韩中文视频在线
|
国产午夜理论片YY8840Y
|
羞羞漫画在线播放
|
99精品视频在线观看免费
|
国产曰批试看免费视频播放免费
|
艳鉧动漫片1~6全集在线
|
伊人青青草
|
欧美性爱 成人
|
狠狠躁天天躁小说
|