如果你无法在服务器上安装imail,那只能通过socket来发送邮件。但是如果你幸运的话,也可以用163/sina的
smtp服务。
例程如下(原程序由马毅兄提供):
<html>
<head>
<title>mail form anywhere </title>
</head>
<body>
<?
if($sendit)
{
$smtpserver="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")) {
| 对此文章发表了评论 |
