<?php
include('Mail.php');
include('Mail/mime.php');
$text = 'Text version of email';//文本格式显示内容
$html = '<html><body>HTML version of email<br/><img src="mm.jpg"></body></html>';//html格式显示内容
$file = 'c:/news.txt';//发送附件
$crlf = "\r\n";//回车换行
$hdrs = array(
              'From'    => '[email protected]',
              'TO'      => '[email protected]',
              'Subject' => 'Test mime message'//主题
              );//这个是用来设置头文件信息
$mime = new Mail_mime($crlf);
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->addHTMLImage('c:\mm.jpg');
$mime->addAttachment($file, 'text/plain');
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
/*
smtp
$param["host"] - The server to connect. Default is localhost
$param["port"] - The port to connect. Default is 25
$param["auth"] - Whether or not to use SMTP authentication. Default is false
$param["username"] - The username to use for SMTP authentication.
$param["password"] - The password to use for SMTP authentication.
*/$param = array(
               'host' => '212.217.197.11',//smtp地址
               'port' => 25,
               'auth' => false,
               'username' => '',
               'password' => ''
               );//用哪个邮件服务器的设置,这里设置需要验证的用户名密码$mail =& Mail::factory('smtp', $param);
$s = $mail->send('[email protected]', $hdrs, $body);
if (PEAR::isError($s)){
echo $s->getMessage();//获取的错误信息
} else {
echo 'success!';//成功返回的信息
}?>
就这个,够详细了吧