Heim  >  Artikel  >  php教程  >  关于那个SMTP类及一个例子

关于那个SMTP类及一个例子

WBOY
WBOYOriginal
2016-06-13 11:19:491890Durchsuche

因为显示的原因,发上来的帖里里有一些空格被删除了,造成大家使用上的一些错误。
分析如下:
1,因为不经意的修改,大家拿到这样的很优秀的类后,总希望改成自己看起来舒心一些。不过我需要提醒一些,在这个程序里,有时增加或者删除几个空格都会造成程序出错。
2,现在我将发上来的程序的一些问题说说明一下。
Content-Type:后面的1-2行前面要有数个空格。请加上。HTML中每一行前面的空格都不会显示,所以,帖子里没有了。
这是前面一个朋友帖出的内容,我修改后如下:
This is a multi-part message in MIME format.
--=====_1__=====
Content-Type: multipart/alternative;
  boundary="=====_2__====="
--=====_2__=====
Content-Type: text/plain;
  charset="GB2312"
  Content-Transfer-Encoding: base64
x+vKudPD1qez1khUTUwguPHKvbXE08q8/sjtvP7AtLLpv7S4w9PKvP4=
--=====_2__=====
Content-Type: text/html;
  charset="GB2312"
  Content-Transfer-Encoding: base64
PGh0bWw+PGhlYWQ+PC9oZWFkPjxib2R5PjxoMT7A/dfTPC9oMT48L2JvZHk+PC9odG1sPg==
--=====_2__=====--
--=====_1__=====--
这里有一个例子:
其实很简单的。
$sender= new smtp();
$fromname="sony";
$frommail="sonymusic@china.com";
$toname="pbabi";
$tomail="panbei@163.net";
$subject="一个例子";
$text_body="请使用支持HTML 格式的邮件软件来查看该邮件";
$html_body.="

例子

";
$send_ok=$sender->send($fromname,$toname,$frommail,$tomail,$subject,$text_body,$html_body);


Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn