NT下基于邮件服务软件(IMAIL)的发送程序

时间:2010-01-12 09:07:57   来源:第二电脑网  作者:第二电脑网

  第二电脑网导读: </TITLE></HEAD><BODY><?if($sendit){$smtpserver="202.110.200.242" ;        //将此处设为IMAIL的IPecho "<pre>" ;$fp = fsockopen($smtpserver, 25, &$errno, &$errstr, 10) ; //连接smtp服务器,端口25if(!$fp) die("wrong open smtp SERVER") ;$hostreplay=f...
  正文:

如果你无法在服务器安装IMAIL,那只能通过socket来发送邮件。但是如果你幸运的话,也可以用163/sina的

smtp服务。

例程如下(原程序由马毅兄提供):
<HTML>
<HEAD>
<TITLE>Mail Form anywhere </TITLE>
</HEAD>
<BODY>
<?
if($sendit)
{
$smtphotoshop/ target=_blank class=infotextkey>pserver="202.110.200.242" ;        //将此处设为IMAIL的IP
echo "<pre>" ;
$fp = fsockopen($smtpserver, 25, &$errno, &$errstr, 10) ; //连接smtp服务器,端口25
if(!$fp) die("wrong open smtp SERVER") ;
$hostreplay=fgets($fp,128);
//if (!strstr($hostreplay,"220")) die(" can n't receive the 220 answer ") ;
$smailname=strstr(ltrim($hostreplay),"220 ") ;
$smailname=substr($smailname,0,strpos($smailname,".")) ;
//echo "/nsmailname:$smailname/n" ;
fputs($fp,"$smailname /n") ;
$hostreplay=fgets($fp,128);
//if (!strstr($hostreplay,"250")) die(" can n't receive the 250 answer ") ;

fputs($fp,"MAIL FROM: /n") ;
$hostreplay=fgets($fp,128) ;
if (!strstr($hostreplay,"250")) {
fputs($fp,"MAIL FROM: root/n") ;
$hostreplay=fgets($fp,128) ;
if (!strstr($hostreplay,"250")) {
fputs($fp,"MAIL FROM: root@263.net/n") ;
echo($hostreplay=fgets($fp,128)) ;
if (!strstr($hostreplay,"250")) {
fputs($fp,"MAIL FROM: $from_address/n") ;
$hostreplay=fgets($fp,128) ;
if (!strstr($hostreplay,"250")) die(" can n't receive the 250 answer ") ;
};
};
};
fputs($fp,"RCPT TO: $to_address/n") ;
$hostreplay=fgets($fp,128);
if (!strstr($hostreplay,"250")) {
fputs($fp,"RCPT TO: $mailname/n") ;
$hostreplay=fgets($fp,128) ;
if (!strstr($hostreplay,"250")) echo(" can n't receive the 354 answer") ;
};
fputs($fp,"DATA/n") ;
$hostreplay=fgets($fp,128) ;
if (!strstr($hostreplay,"354")) die(" can n't receive the 250 answer ") ;
$tosend="From: $from_address/n";
$tosend.="To: $to_address/n";
$tosend.="Subject:".str_replace("/N"," ",$subject)."/n你好,这是yukuang发给您的一封测试信!!

/n./n";
fputs($fp,$tosend) ;
$hostreplay=fgets($fp,128) ;
if (!strstr($hostreplay,"250")) die(" can n't receive the 250 answer ") ;
fputs($fp,"QUIT/n") ;
fclose($fp) ;
echo "发送成功";
exit();
//if($ck_name!='root') die("</pre><hr>bye bye ");

};

?>

<br>
<FORM METHOD="POST" ACTION=" <? echo $PHP_SELF; ?>" >
<table width="73%" border="1" align="center">
<tr>
<td colspan="5">
<div align="center">cn-bbs web meil </div>
</td>
</tr>
<tr>
<td width="9%">from<br>
</td>
<td width="36%">
<input type="text" name="from_address" size="30" maxlength="40"
value="">
</td>
<td width="6%">to </td>
<td colspan="2" width="49%">
<input type="text" name="to_address" size="40" maxlength="40"
value="">
</td>
</tr>
<tr>
<td width="9%">subject</td>
<td colspan="4">
<input type="text" name="subject" size="80" maxlength="200" value=" ">
</td>
</tr>
<tr>
<td rowspan="5" width="9%">c<br>
o<br>
n<br>
t<br>
e<br>
n<br>
t</td>
<td colspan="4" rowspan="5">
<div align="center">
<textarea name="message" cols="80" rows="16"> </textarea>
</div>
</td>
</tr>
<tr> </tr>
<tr> </tr>
<tr> </tr>
<tr> </tr>
<tr>
<td colspan="5" height="2">
<div align="center">
<select name="smtpserver">
<option value="smtp.21cn.com" selected>21cn.net</option>
来源:http://www.002pc.com/master/College/Programming/PHP/11747.html

收藏到:

关于《NT下基于邮件服务软件(IMAIL)的发送程序》文章的评论

共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面

随机文章

    SQL Error: select * from ***_ecms_article where classid='86' and checked=1 order by rand() limit 10

顶出来的热门

    SQL Error: select * from ***_ecms_article where classid='86' and checked=1 order by diggtop desc,id desc limit 10
站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td