PHP 的SMTP类已经很多、很成熟了。 建议你有时间GOOGLE一下~~~~~

解决方案 »

  1.   

    再详细一点吧:$target="[email protected]"//发送目标
    $title="title of the mail";//标题
    $content="******"//邮件正文SMTP服务器是要权限验证的,我看了一下php.ini中有SMTP="localhost"一句,还有个for Win32 only之类的,不知道linux下该怎么弄
      

  2.   

    SMTP的类,一般都是用 Socket 直接连接 SMTP 服务器,按照SMTP协议进行发送EMAIL的。
    建议看看别人的源码及SMTP 协议的内容,你就会明白了~~
      

  3.   

    Linux下和windows下发邮件有些不同吧,php.ini里的一些内容:[mail function]
    SMTP = localhost ;仅用于win32系统
    sendmail_from = [email protected] ;仅用于win32系统
    ;sendmail_path = ;仅用于unix, 也可支持参数(默认的是'sendmail -t -i')
      

  4.   

    如果你的服务器支持PEAR,那就用这个吧<?php
    /*
    Project Name: PublicClslib
    Class Name: SmtpMail
    File Name: SmtpMail.cls.php
    Description:  利用PEAR的Smtp发送邮件类Author:  Walter Liu
    Create time: 2004-09-25
    version: 1.0.0
    ==========================================================================================
    @
    ==========================================================================================
    */
    require_once 'Mail.php'; class SmtpMail
    {
    /**
     * 服务器名称
     *
     * @var string
     */
    var $__host = "localhost";


    /**
     * true表示smtp服务器需要验证,false代码不需要
     *
     * @var bool
     */
    var $__auth = true;


    /**
     * 用户名
     *
     * @var string
     */
    var $__username = "";
    /**
     * 密码
     *
     * @var string
     */
    var $__password = "";


    /**
     * 配置数组
     *
     * @var string
     */
     var $__conf;
     
    /**
     * 邮件头数组
     *
     * @var string
     */  
     var $__header;
     
    function SmtpMail($host = null , $username = null, $password = null)
    {
    $this->__host = $host != null ? $host : $this->__host;
    $this->__username = $username != null ? $username : $this->__username;
    $this->__password = $password != null ? $password : $this->__password;

    $this->__conf['mail'] = array(
            'host'     => $this->__host,             
            'auth'     => $this->__auth,                         
            'username' => $this->__username,                 
            'password' => $this->__password                   
    );
    }

    function send($to, $from,  $subject, $body, $type = 'html')
    {
    $this->__header['type'] = $type;
    $this->__header['From'] = $from;
    $this->__header['To'] = $to;
    $this->__header['Subject'] = $subject;

    $mailObject = &Mail::factory('smtp', $this->__conf['mail']);
    $mail_res = $mailObject->send($this->__header['To'], $this->__header, $body);        //发送 
    if( Mail::isError($mail_res) ){                         //检测错误 
        die($mail_res->getMessage()); 

    }

    }
    ?>
      

  5.   

    有个phpmailer的smtp类,你可以下载参考一下.它支持HTML,附件等...
      

  6.   

    http://blog.csdn.net/czcty/archive/2005/01/25/267020.aspx