我再来转载一篇用EMAIL附件传送一个文件(用mail)-PHP代码-PHP教程-幽默笑话

我再来转载一篇用EMAIL附件传送一个文件(用mail)-PHP代码-PHP教程-幽默笑话

文章内容我再来转载一篇"用EMAIL附件传送一个文件(用mail)"修改时间:[2010/02/2503:52]阅读次数:[779]发表者:[起缘]/**Classmime_mail*OriginalimplementationbySaschaSchumann[emailprotected]*ModifiedbyTobiasRatschiller[emailprotected]:*-Generalcodeclean-up*-separatebody-andfrom-property*-killedsomemostlyun-necessarystuff*/classmime_mail{var$parts;var$to;var$from;var$headers;var$subject;var$body;/**voidmime_mail()*classconstructor*/functionmime_mail(){$this-parts=array();$this-to=$this-from=$this-subject=$this-body=$this-headers=}/**voidadd_attachment(stringmessage,[stringname],[stringctype])*Addanattachmenttothemailobject*/functionadd_attachment($message,$name=,$ctype=application/octet-stream){$this-parts[]=array(ctype=$ctype,message=$message,encode=$encode,name=$name);}/**voidbuild_message(arraypart=*Buildmessagepartsofanmultipartmail*/functionbuild_message($part){$message=$part[message];$message=chunk_split(base64_encode($message));$encoding=base64returnContent-Type:.$part[ctype].($part[name]name=\.$part[name].\:).Content-Transfer-Encoding:$encoding$message}/**voidbuild_multipart()*Buildamultipartmail*/functionbuild_multipart(){$boundary=(uniqid(time()));$multipart=Content-Type:multipart/mixed;boundary=$boundaryThisisaMIMEencodedmessage.--$boundaryfor($i=sizeof($this-parts)-1;$i=0;$i--){$multipart.=.$this-build_message($this-parts[$i]).--$boundary}return$multipart.=--}/**voidsend()*Sendthemail(lastclass-functiontobecalled)*/functionsend(){$mime=if(!empty($this-from))$mime.=From:.$(!empty($this-headers))$mime.=$(!empty($this-body))$this-add_attachment($this-body,,text/plain);$mime.=MIME-Version:$this-build_multipart();mail($this-to,$this-subject,,$mime);}};//endofclass/**Exampleusage*$attachment=fread(fopen(,r),filesize());$mail=newmime_mail();$mail-from=[emailprotected]$mail-headers=Errors-To:[emailprotected]$mail-to=[emailprotected]$mail-subject=Testing...$mail-body=Thisisjustatest.$mail-add_attachment($attachment,,image/jpeg);$mail-send();*/。

<#longshao:sxy_article#>

你还会喜欢:

{主关键词}
《执笔抒情唯爱卿》小说全文免费试读 木婉心夏洵小说全文

{主关键词}
创金合信春来回报A(005799)基金费率

{主关键词}
富国中证移动互联网指数分级证券投资基金可能发生不定期份额折算的风险提示公告(2017119)

{主关键词}
小学二年级游记作文200字 美丽的丽江-游记

{主关键词}
父亲虐待孩子被剥夺监护人资格 曾“出租”子女给小偷行窃打掩护

{主关键词}
春节好词好句 猴年新春佳词佳句

{主关键词}
我们这一天第一季观后感800字

{主关键词}
1034,八面玲珑重生之俗人一枚最新章节

{主关键词}
神医执拗,神医执拗章节列斗争,神医奸详涓滴,神医执拗无弹窗,神医执拗txt全集下载,神医执拗全文浏览,君子堂小说浏览网www.jzt2011.com

{主关键词}
情侣间如何维系感情?给彼此更多私人空间

{主关键词}
2019年高考时间为:6月7、8、9日 蒹葭赏析

{主关键词}
易方达基金管理有限公司关于调整易方达深证成指交易型开放式指数证券投资基金场外份额在直销中心申购、赎回业务数额限制的公告