求一个可以发送HTML邮件的php类!

来源:百度知道 编辑:UC知道 时间:2024/06/22 21:22:54

在php.ini里设置了smtp服务器,和连接smtp服务器的用户名和密码
<?php
function send_mail($from, $to, $subject, $message)
{
if ($from == "")
{
$from = '管理员 <webmaster@163.com>';//发件人地址
}
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=gb2312' . "\r\n";
$headers .= 'From: ' . $from . "\r\n";
mail($to, $subject, $message, $headers);
}
?>